Hi,
I have a few questions:
1. What is the difference between SendMessage and PostMessage?
2. Am I using SendMessage correctly? I want to emulate mouse movement in a certain window while still being able to use the computer.
Code:
#include <iostream>
#include <windows.h>
using namespace std;
int main() {
POINT btn;
HWND mWindow;
cout<<"Set Mouse Over button and press ENTER";
cin.get();
GetCursorPos(&btn);
cout<<"\nAfter Pressing ENTER, you have 5 seconds to set focus to the correct window.";
cin.get();
Sleep(5000);
mWindow = GetFocus();
SendMessage(mWindow,WM_MOUSEMOVE,0,MAKELPARAM(btn.x,btn.y));
SendMessage(mWindow,WM_LBUTTONDOWN,0,MAKELPARAM(btn.x,btn.y));
SendMessage(mWindow,WM_LBUTTONUP,0,MAKELPARAM(btn.x,btn.y));
return 0;
}
Please DO NOT suggest SendInput / mouse_event. They do not do what I am looking for. (AKA they hijack the mouse)
Thanks!