Converting spy ++ messages to code ?

Hey, using MFC and just playing around with spy++ and I think this is the info I need to be able to emulate a button click. These were the messages sent when I filtered.

S WM_MOUSEACTIVATE hwndTopLevel:003503CA nHittest:HTCLIENT uMsg:WM_LBUTTONDOWN
S WM_MOUSEACTIVATE fuActivate:MA_ACTIVATE
P WM_LBUTTONDOWN dwKeys:MK_LBUTTON xPos:18 yPos:18
P WM_LBUTTONUP dwKeys:0000 xPos:18 yPos:18

how would I code this in c++ ? I just want to be able to do exactly the same as clicking this using API, am I missing any data to help emulate the click?
The general idea is to use SendMessage() API. Look in MSDN for each message to know WPARAM and LPARAM parameters should be.
yeh to be honest at this point im even looking to be spoon fed the code lol, I have searched MSDN , googled and searched here, I have the buttons handle, I have its caption I just have no idea how I can click it. As I said before I can manipulate everything I want in the parent but I have no idea how I can just click this button!!! anymore suggestions?
I have searched MSDN , googled and searched here, I have the buttons handle, I have its caption I just have no idea how I can click it.


What specifically did you expect ? An already written code ?


SendMessage(hWnd, WM_LBUTTONDOWN, MK_LBUTTON, MAKELPARAM(mousePosX, mousePosY));

You may need to notify for WM_LBUTTONUP as well, depending on the way you application handles it's mouse events.
What do you need the emumulation for?

The way I generate mouse clicks (and moves) for testing purposes is using the SendInput() API call.

SendInput function
http://msdn.microsoft.com/en-us/library/windows/desktop/ms646310(v=vs.85).aspx

This function synthesizes mouse button clicks, etc which are then mapped as using to Windows messages.

Andy

PS If you search cplusplus.com for "SendInput" you'll find assorted earlier discussions about generating mouse and keyboard input, inc. code fragments.
Last edited on
Topic archived. No new replies allowed.