RE: [Dev-C++] Win32 API SendMessage [mx][sls]
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Geoff B. <Geo...@Vc...> - 2003-10-02 17:06:56
|
Yes well I got this figured out now, what I did was tell the second =
thread
to run a postmessage function and set a variable so the main window =
knows
what is happening. However I am also trying to incorperate the =
mainwindow
sending a message to itself and your are correct using postmessage is =
the
only way to do this. As soon as I switched from send to post =
everything is
now working.
=20
thanks
-geoff
-----Original Message-----
From: Carlos Garc=EDa del Monte [mailto:sol...@ya...]
Sent: October 2, 2003 10:38 AM
To: Geoff Baker
Cc: dev...@li...
Subject: Re: [Dev-C++] Win32 API SendMessage [mx][sls]
That means your window is sending a message to itself, isn't it? That =
seems
to be not possible, always I try to do something like that it doesn't =
react
to it, and if I put a GetLastError() I get INVALID_WINDOW_HANDLE.
Everytime I got that I had to do things another way, nothing comparable =
with
the situation where sending a message itself would be necessary.
If you really need do things like that and neither PostMessage work, I =
would
suggest making a dummy window, SW_HIDE, so you send the message to the =
dummy
and it resends it to the main, is the only way I can think about.
Did you try with PostMessage? Remember that SendMessage sends the =
message
and waits to the window to process it, but it can't do while it is
processing the current message.=20
Be careful about this situation:
Main receives "do push button" push button says itself "message: do it, =
then
continue". If things are like this and you send the message when "do =
it" and
after that is "then continue". If you do Sendmessage "do it", it'll =
wait to
"do it" to be done, but it can't if "then continue isn't done" (Uhmm, =
the
same would happen with the dummy window!!). If you PostMessage then it =
would
post "do it" and immediately it performs "then continue", so it makes =
"then
continue" before knowing the result of "do it", so perhaps you would =
have to
make: receive message (a) push button posts message "do it" (b) and =
after do
"do it" it posts "then continue" (c), but perhaps it would need to =
happen
that a=3Dc, but with some extra parameter so the program can =
distinguish
beetwen the message x being sent for start or for continue. Or perhaps, =
your
program performs steps that are not equivalent to this scheme and you =
don't
need worry about it.
Hope you get the perfect answer.
Geoff Baker wrote:
I am trying to setup a Push Button control that when pushed, runs a =
series
of commands, then calls itself to be run again. The reason behind this =
is
that there is another thread that needs to process some data prior to =
the
second half of the function being run. To do this I thought I could =
simply
send a message to my main window (put the message into the que) so that =
once
the other threads message has completed the button will be recalled.
However this does not seem to happen, it simply ignores my sendmesage =
(or so
it seems)
Code:
case 508:
switch(setup)
{
case 0:
FindSearch=3DFindInBuffer("]#",2);
if(FindSearch=3D=3D1)
{
MessageBox(NULL,"Prompt
Check","Error",MB_OK|MB_ICONEXCLAMATION); =20
} =20
setup=3D1; =20
break;
case 1:
FindInBuffer("]#",1);
Command(" ",hwnd);
=20
SendMessage(hwnd,WM_COMMAND,(WPARAM)NULL,(LPARAM)508);=20
break;
}
break;
End Code:
Does anyone know how to handle a situation like this?
=20
Thanks
Geoff Baker
Systems Integration Technologist
=20
VCom (Formerly WaveCom)
=20
150 Cardinal Place, Saskatoon, Sask. Canada S7L 6H7
Phone: (306)955-7075 Ext 489 Fax:(306)955-9919
Web Page: <http://www.vcom.com/> <http://www.vcom.com/>
=20
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf <http://thinkgeek.com/sf>=20
_______________________________________________
Dev-cpp-users mailing list
Dev...@li...
<mailto:Dev...@li...>=20
TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm
<http://www23.brinkster.com/noicys/devcpp/ub.htm>=20
https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
<https://lists.sourceforge.net/lists/listinfo/dev-cpp-users>=20
=20
|