Hi all,

I am using SendMessage to manipulate the window of another process. The
problem is that when I use SendMessage to click a certain button a
MessageBox is displayed and my program will not continue until the user
clicks the OK button, which is not what I want.

Therefore, I switched to using PostMessage to click the button, which allows
my program to continue, except I need to know when it has pressed the button
so I can close the MessageBox. If my program runs directly through, it does
not find the MessageBox because the button has not been pushed yet. So if I
use PostMessage to click the button, how do I determine when this message
has completed so I can close the MessageBox and resume my other tasks?

Thanks for any help!
Cole

Re: SendMessage, PostMessage problems with MessageBox by 100

100
Mon Jan 26 14:13:34 CST 2004

Hi Cole,
There is no way to determine when a posted message has been processed.
I think it won't be of any help to you, but just a reminder that there exist
an API called SendMessageCallback
It sends a message but returns immediately and your programm won't get
blocked until the message is in process When the message is precessed your
callback will be called with the result of the message processing. But in
your case I'm afraid that the callback won't be called until the message
box is on the screen.

The other solution is to install a windows hook which will listen for
opening a message box and will notify you or even close the message box for
you.
There are articles in MSDN 2002 issues about how to install windows hooks
(with source code) and what might be useful for you example how to intercept
creation of message boxes.
You can find that article here
http://msdn.microsoft.com/msdnmag/issues/02/11/CuttingEdge/default.aspx

HTH
B\rgds
100

"Cole Shelton" <scolemann@_NO_SPAM_yahoo.com> wrote in message
news:%23jaKq$D5DHA.2572@TK2MSFTNGP09.phx.gbl...
> Hi all,
>
> I am using SendMessage to manipulate the window of another process. The
> problem is that when I use SendMessage to click a certain button a
> MessageBox is displayed and my program will not continue until the user
> clicks the OK button, which is not what I want.
>
> Therefore, I switched to using PostMessage to click the button, which
allows
> my program to continue, except I need to know when it has pressed the
button
> so I can close the MessageBox. If my program runs directly through, it
does
> not find the MessageBox because the button has not been pushed yet. So if
I
> use PostMessage to click the button, how do I determine when this message
> has completed so I can close the MessageBox and resume my other tasks?
>
> Thanks for any help!
> Cole
>
>



Re: SendMessage, PostMessage problems with MessageBox by Cole

Cole
Mon Jan 26 15:55:53 CST 2004

100,

Thanks for the info. I haven't managed to get the hook working yet (events
don't seem to be firing), but I think this is the right direction.

Cole

"100" <100@100.com> wrote in message
news:%23FENbiE5DHA.2496@TK2MSFTNGP09.phx.gbl...
> Hi Cole,
> There is no way to determine when a posted message has been processed.
> I think it won't be of any help to you, but just a reminder that there
exist
> an API called SendMessageCallback
> It sends a message but returns immediately and your programm won't get
> blocked until the message is in process When the message is precessed your
> callback will be called with the result of the message processing. But in
> your case I'm afraid that the callback won't be called until the message
> box is on the screen.
>
> The other solution is to install a windows hook which will listen for
> opening a message box and will notify you or even close the message box
for
> you.
> There are articles in MSDN 2002 issues about how to install windows hooks
> (with source code) and what might be useful for you example how to
intercept
> creation of message boxes.
> You can find that article here
> http://msdn.microsoft.com/msdnmag/issues/02/11/CuttingEdge/default.aspx
>
> HTH
> B\rgds
> 100
>
> "Cole Shelton" <scolemann@_NO_SPAM_yahoo.com> wrote in message
> news:%23jaKq$D5DHA.2572@TK2MSFTNGP09.phx.gbl...
> > Hi all,
> >
> > I am using SendMessage to manipulate the window of another process.
The
> > problem is that when I use SendMessage to click a certain button a
> > MessageBox is displayed and my program will not continue until the user
> > clicks the OK button, which is not what I want.
> >
> > Therefore, I switched to using PostMessage to click the button, which
> allows
> > my program to continue, except I need to know when it has pressed the
> button
> > so I can close the MessageBox. If my program runs directly through, it
> does
> > not find the MessageBox because the button has not been pushed yet. So
if
> I
> > use PostMessage to click the button, how do I determine when this
message
> > has completed so I can close the MessageBox and resume my other tasks?
> >
> > Thanks for any help!
> > Cole
> >
> >
>
>