-
September 29th, 2010, 10:12 AM
#1
GetMessage() questions
Hi,
I want to write a program that listens for a window action (creates a window or closes a window) and when a window is created i get new window handle in an HWND array and remove it when i close the window.
By now i'm able to retrieve the main window handle and i guess i have to use the GetMessage() function, something like this;
HWND parent = FindWindow(NULL,"Main Window Name");
MSG msg;
while (GetMessage(&msg, parent, 0, 0))
{
if (msg.message == WM_CREATE )
MessageBox(NULL,"new window","Message:",MB_OK);
TranslateMessage(&msg);
DispatchMessage(&msg);
}
Please give me some suggestions or at least point me to some good tutorials.
PS: i'm really new with win32 programming ...
Thank you.
-
September 30th, 2010, 07:26 PM
#2
Re: GetMessage() questions
Are you referring to a window action within your application or another process?
-
October 1st, 2010, 06:53 AM
#3
Re: GetMessage() questions
I'm referring to a window from another application, i read what i could find on codeguru yesterday and i understand that i have to make it with hooks, which right now look kind of complicated. I understood a bit of how they work, but they are still pretty blurry. Actually my software is intended to click on a button when it appears on some specific windows so i guess that if i find the message that the window sends when the button appears i could intercept this message with a hook and click on the button in the window although it's in background ( i made the function for clicks with PostMessage and it works).
Do you have any suggestions ? Is this possible ?
thank you
-
October 1st, 2010, 08:02 AM
#4
Re: GetMessage() questions
i played around with Spy++ over the window that i have to post the click to an i filtered the messages and i came up with this:
00031084 P message: 0x0118 [Unknown] wParam:0000FFF8 lParam:97B03836
after this message has appeared for 4 times in a row, i have to click on the button.
is there any way i can use this ?
-
October 1st, 2010, 03:42 PM
#5
Re: GetMessage() questions
Do you have any suggestions ? Is this possible ?
Not with GetMessage. GetMessage is intended to process messages from the message queue belonging to current thread. So, in your case there's nothing left but hooks.
Best regards,
Igor
-
October 1st, 2010, 07:20 PM
#6
Re: GetMessage() questions
yes, i posted that before i found out about hooks ...
so for that type of message, what hook procedure could be used ?
the message is : 00031084 P message: 0x0118 [Unknown] wParam:0000FFF8 lParam:97B03836
i'm thinking WH_CALLWNDPROC ... maybe you could direct me to some examples with the exact hook i need ... because all i found is about keyboard hooking
-
October 1st, 2010, 09:54 PM
#7
Re: GetMessage() questions
Originally Posted by rzv
yes, i posted that before i found out about hooks ...
so for that type of message, what hook procedure could be used ?
the message is : 00031084 P message: 0x0118 [Unknown] wParam:0000FFF8 lParam:97B03836
i'm thinking WH_CALLWNDPROC ... maybe you could direct me to some examples with the exact hook i need ... because all i found is about keyboard hooking
Have you tried searching for "window hooking"?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|