Hi,
I'm having trouble getting my sendmessage function right. I want to send a click on a specific coordinate to the window.
I know this is the api:
[DllImport("user32.dll")]
public static extern int SendMessage(
int hWnd, // handle to destination window
uint Msg, // message
long wParam, // first message parameter
long lParam // second message parameter
);
1) The first problem that occurs is that my hWnd is an IntPtr and not an int. (I get my hWnd with findWindow). How can I resolve this?
2) I also want to ask if my lParam, which I need to set my coordinate too, if it is made properly?
This is a mix of what I found on the internet. However I don't know how the long result works?
public const uint WM_CLICK = 0x00F5;
public static long makeDWord(int LoWord, int HiWord)
{
long result = (LoWord + (HiWord << 16));
return result;
}
long lParam = makeDWord(a, b);
//a is x-axis, b is y-axis
int click = SendMessage(hWnd, WM_CLICK, null, lParam);
Help is greatly appreciated.