Article View: borland.public.cppbuilder.nativeapi
Article #6364Re: "use" menu item in another app?
From: Segal
Date: Thu, 19 May 2005 19:33
Date: Thu, 19 May 2005 19:33
57 lines
3385 bytes
3385 bytes
Remy Lebeau (TeamB) wrote:
> "Segal" <none@none.spam.sucks.balls> wrote in message
> news:428ccca8@newsgroups.borland.com...
>
>> how ever, the "OK" button is grayed out and wont respon d to
>> BM_CLICK. If I manaully go to said message box with my
>> mouse and manually type a character in the field it enables the
>> button. But it doesn't enable it when I insert text from my program.
>
> You did not show how you are filling in the dialog exactly.
> Apparently, the dialog expects individual characters to be typed, but
> without seeing your actual code, I would guess that you are not
> simulating any typing at all, just assigning the text in full, which
> the dialog is not coded to handle the same way.
My apologies.
// First text field (both text fields are of class "Edit".)
HWND EditHwnd = FindWindowEx(hwnd, EditHwnd, "Edit", NULL);
if (!EditHwnd) return;
SendMessage(EditHwnd, WM_SETTEXT, (WPARAM)50,
(LPARAM)SingleLine->Text.c_str());
// 2nd text field.
EditHwnd = FindWindowEx(hwnd, EditHwnd, "Edit", NULL);
if (!EditHwnd) return;
SendMessage(EditHwnd, WM_SETTEXT, (WPARAM)50,
(LPARAM)MultiLine->Lines->Text.c_str());
>> Is is possible that BM_CLICK is being ignored?
>
> Possibly. MSDN says the following:
>
> "If the button is in a dialog box and the dialog box is not
> active, the BM_CLICK message might fail. To ensure success in this
> situation, call the SetActiveWindow function to activate the dialog
> box before sending the BM_CLICK message to the button."
>
> Have you tried sending a WM_COMMAND/BN_CLICKED message to the dialog
> rather than sending BM_CLICK to the button?
I just tried both
SendMessage(hwnd, WM_COMMAND, 0, 0);
and
SendMessage(hwnd, BN_CLICKED, 0, 0);
I even tried
EnableWindow(hwnd, TRUE);
before both of those calls and it still doesn't submit the box (as if
"OK" is clicked.) If I try using the Cancel button intead it doesn't
work either. The box just stays there. If I manually click either button
they work fine.
Technical Details
Message-ID:
<428cea2d@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!border1.nntp.dca.giganews.com!nntp.giganews.com!diablo.voicenet.com!38.144.126.100.MISMATCH!feed5.newsreader.com!newsreader.com!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mailReferences:
<4289b235@newsgroups.borland.com> <v54k81lu0gb49sp76ri3ecjhb37gfbcatq@4ax.com> <428a1917$3@newsgroups.borland.com> <o2ck8151hqea0h667513g8lh0h8149n6aq@4ax.com> <428c2e72@newsgroups.borland.com> <428c6ef5$1@newsgroups.borland.com> <428ccca8@newsgroups.borland.com> <428cdbec@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,de4107a245e3b3a8 X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Segal" <none@none.spam.sucks.balls> Newsgroups: borland.public.cppbuilder.nativeapi References: <4289b235@newsgroups.borland.com> <v54k81lu0gb49sp76ri3ecjhb37gfbcatq@4ax.com> <428a1917$3@newsgroups.borland.com> <o2ck8151hqea0h667513g8lh0h8149n6aq@4ax.com> <428c2e72@newsgroups.borland.com> <428c6ef5$1@newsgroups.borland.com> <428ccca8@newsgroups.borland.com> <428cdbec@newsgroups.borland.com> Subject: Re: "use" menu item in another app? Date: Thu, 19 May 2005 12:33:58 -0700 Lines: 59 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2180 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-RFC2646: Format=Flowed; Original NNTP-Posting-Host: 66.234.219.101 Message-ID: <428cea2d@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1116531245 66.234.219.101 (19 May 2005 12:34:05 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!border1.nntp.dca.giganews.com!nntp.giganews.com!diablo.voicenet.com!38.144.126.100.MISMATCH!feed5.newsreader.com!newsreader.com!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail