Article View: borland.public.cppbuilder.nativeapi
Article #9904Re: How to click a button in another program?
From: Remy Lebeau (TeamB)
Date: Thu, 03 Jun 2004 20:48
Date: Thu, 03 Jun 2004 20:48
36 lines
1896 bytes
1896 bytes
"TerryC" <terryc.dont_spam_me@sweetwaterhsa.com> wrote in message
news:40bf8884$1@newsgroups.borland.com...
> This appears to click the button -- the button goes down
> and back up -- but the dialog never closes! What gives?
You should be sending a BN_CLICKED notification to the dialog window itself
instead of simulating a button press. For example:
BOOL __stdcall EnumProc(HWND hWnd, LPARAM lParam)
{
char caption[32] = [0];
SendMessage( hWnd, WM_GETTEXT, 32, (LPARAM)caption);
if( StrLComp(caption, "Microsoft Office Outlook", 32) == 0 )
{
HWND hBtn = GetDlgItem( hWnd, IDYES );
if( hBtn )
{
SendMessage( hwnd, WM_COMMAND, MAKEWPARAM(IDYES,
BN_CLICKED), (LPARAM)hBtn );
return FALSE;
}
}
return TRUE;
}
void __fastcall TfMain::RptTimer(TObject *Sender)
{
EnumWindows((WNDENUMPROC)EnumProc, NULL);
}
Gambit
Technical Details
Message-ID:
<40bf8f94$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<40bf8884$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,6be234126fe720da X-Google-Attributes: gid10cc67,public From: "Remy Lebeau \(TeamB\)" <gambit47.no.spam@no.spam.yahoo.com> Newsgroups: borland.public.cppbuilder.nativeapi References: <40bf8884$1@newsgroups.borland.com> Subject: Re: How to click a button in another program? Date: Thu, 3 Jun 2004 13:48:15 -0700 Lines: 38 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1409 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409 NNTP-Posting-Host: 67.22.135.163 Message-ID: <40bf8f94$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1086295956 67.22.135.163 (3 Jun 2004 13:52:36 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail