Help me, Please!
I do not know why, when this command crash.
$ msg = DllStructCreate ('HWND hwnd; UINT message; WPARAM wParam; LPARAM lParam; DWORD time; ptr pt')
DllCall ('user32.dll', 'bool', 'GetMessageW', 'ptr', DllStructGetPtr ($ msg))
I want to get messages from the queue by an application, how? Please help me, I am very thankful!
Help me with GETMESSAGE
Started by nlhung, Jan 25 2012 07:14 AM
8 replies to this topic
#1
Posted 25 January 2012 - 07:14 AM
#2
Posted 25 January 2012 - 03:15 PM
http://msdn.microsoft.com/en-us/library/windows/desktop/ms644936%28v=vs.85%29.aspx
When you use DllCall, your parameters need to match this.
When you use DllCall, your parameters need to match this.
#3
Posted 26 January 2012 - 03:11 AM
Yes, I know. But type "LPMSG" in Window to AutoIt is What?
I think it's "ptr". And tagMsg in Window is
typedef struct tagMSG {
HWND hwnd;
UINT message;
WPARAM wParam;
LPARAM lParam;
DWORD time;
POINT pt;
} MSG, *PMSG, *LPMSG;
To AutoIt I write "$msg = DllStructCreate('HWND hwnd;UINT message;WPARAM wParam;LPARAM lParam;DWORD time;ptr pt')".
It true or false?
Thank, Richard Robertson!
I think it's "ptr". And tagMsg in Window is
typedef struct tagMSG {
HWND hwnd;
UINT message;
WPARAM wParam;
LPARAM lParam;
DWORD time;
POINT pt;
} MSG, *PMSG, *LPMSG;
To AutoIt I write "$msg = DllStructCreate('HWND hwnd;UINT message;WPARAM wParam;LPARAM lParam;DWORD time;ptr pt')".
It true or false?
Thank, Richard Robertson!
#4
Posted 26 January 2012 - 05:20 AM
Yes but you are missing parameters on GetMessage itself.
#5
Posted 26 January 2012 - 05:34 AM
Yes, I fix code into:
$msg = DllStructCreate('HWND hwnd;UINT message;WPARAM wParam;LPARAM lParam;DWORD time;ptr pt')
DllCall('user32.dll','bool','GetMessageW','ptr',DllStructGetPtr($msg),"HWND","0x000A0288","UINT","0x0100","UINT","0x0101")
It can not exit. What can I do to get the message?
$msg = DllStructCreate('HWND hwnd;UINT message;WPARAM wParam;LPARAM lParam;DWORD time;ptr pt')
DllCall('user32.dll','bool','GetMessageW','ptr',DllStructGetPtr($msg),"HWND","0x000A0288","UINT","0x0100","UINT","0x0101")
It can not exit. What can I do to get the message?
#6
Posted 26 January 2012 - 04:09 PM
When you say it can not exit, do you mean that it sits there until you kill the program?
Wait a minute, are you trying to read the message of another program? GetMessage only reads messages on the calling thread's windows. It never returns because you don't own the other window.
Wait a minute, are you trying to read the message of another program? GetMessage only reads messages on the calling thread's windows. It never returns because you don't own the other window.
#8
Posted 01 February 2012 - 09:46 PM
Hi,
as far as I know (and from my experiences) you can not create a message loop with GetMessage in AutoIt.
Because the main function of the AutoIt-Interpreter has already a message loop for the running thread.
If you still do it, AutoIt crashes or never stops running.
But you can call GetMessage sporadically, that's OK.
Regards
Greenhorn
as far as I know (and from my experiences) you can not create a message loop with GetMessage in AutoIt.
Because the main function of the AutoIt-Interpreter has already a message loop for the running thread.
If you still do it, AutoIt crashes or never stops running.
But you can call GetMessage sporadically, that's OK.
Regards
Greenhorn
#9
Posted 02 February 2012 - 12:20 AM
You missed the point entirely. The OP wasn't creating a message loop, he was attempting to get messages for a window that belonged to another program.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users













