capturing and injecting click events into a win32 GUI with an external program
Question
Monday, September 15, 2008 5:05 PM
I have a Windows GUI program written in C++ with VS2005 which outputs a standard win32 .exe and I would like to capture click events and later inject those events into the .exe (preferably with an external program), to create a user-click-replay for automatically test GUI software. I'm just starting so I appreciate and direction or hints.
Thank you
Patrick
All replies (1)
Monday, September 15, 2008 7:06 PM âś…Answered
What i understand is you want to get the mouse click from a compiled exe file .
You can use global hooks SetWindowHookEx() to capture the mouse click and then send the mouse click back to the application by obtaining a handle to the application window .
http://msdn.microsoft.com/en-us/library/ms644990.aspx
You can inject a code or a dll in to your running application and check the messages send to
the application and can send mouse click by using SendMessage( )
http://www.codeproject.com/KB/threads/sendmsg.aspx
A very good article how to inject code
http://www.codeproject.com/KB/threads/winspy.aspx
Note : If you have multiple instance of your application running on the same computer you will need to check if you are sending message to right application .
Vikas