nlhung Posted January 25, 2012 Share Posted January 25, 2012 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! Link to comment Share on other sites More sharing options...
Richard Robertson Posted January 25, 2012 Share Posted January 25, 2012 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. Link to comment Share on other sites More sharing options...
nlhung Posted January 26, 2012 Author Share Posted January 26, 2012 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! Link to comment Share on other sites More sharing options...
Richard Robertson Posted January 26, 2012 Share Posted January 26, 2012 Yes but you are missing parameters on GetMessage itself. Link to comment Share on other sites More sharing options...
nlhung Posted January 26, 2012 Author Share Posted January 26, 2012 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? Link to comment Share on other sites More sharing options...
Richard Robertson Posted January 26, 2012 Share Posted January 26, 2012 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. Link to comment Share on other sites More sharing options...
nlhung Posted January 27, 2012 Author Share Posted January 27, 2012 oh. I don't know it. thank Richard Robertson! Link to comment Share on other sites More sharing options...
Greenhorn Posted February 1, 2012 Share Posted February 1, 2012 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.RegardsGreenhorn Link to comment Share on other sites More sharing options...
Richard Robertson Posted February 1, 2012 Share Posted February 1, 2012 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. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now