I want to use SendMessage to complete part of my remote control program. Case I think it will control the computer program without make it get focus.
Here is my demo. I use windows mspaint to test it. It works when I post "Left button down", so I am sure that my HWND is right(The drawing area handle got by spy++ or some similar tools). It draws a point in my "drawing area" in mspaint. But when I select a color and run the folling code. It doesn't work. Nothing happens in my drawing area on the same mspaint program.
Here is my code:
#include <stdio.h>
#include <Windows.h>
int main(){
HWND hwnd;
printf("Please input your handle\n");
scanf("%d", &hwnd);
int x = 100, y = 100;
//int right = SendMessageA(hwnd, WM_LBUTTONDOWN, MK_LBUTTON, MAKELPARAM(x, y)); //It works
int wrong = SendMessageA(hwnd, WM_RBUTTONDOWN, MK_RBUTTON, MAKELPARAM(x, y)); //It doesn't work
printf("%d", wrong);
printf("%d", GetLastError());
return 0;
}
I am confused because the two lines are so similar. Is there any bugs in mspaint?