I was reading about sending a mouse motion to for example Notepad..
I tried to implement something to help me send a right click to Notepad so when the event fired it shows that there is a right click fired and the right click menu appears in the notepad..
I wrote this code but I'm not sure it's correct -no error but it doesn't work..
// to send the mouse Message
C#
[DllImport("user32.dll")] public static extern int SendMessage(int hWnd,uint Msg, int wParam,int lParam);Code
Code
// mouse input private const uint WM_RBUTTONDOWN = 0x0204;Code
private const uint WM_RBUTTONUP = 0x0205;Code
Code
// event handlerTypeScript
private void button6_Click(object sender, EventArgs e) { int window = FindWindow(null, "Notepad"); {Code
SendMessage(window, WM_RBUTTONDOWN, 0, 0);Code
SendMessage(window, WM_RBUTTONUP, 0, 0); }Code
Code
Thanks in advance :)Code
Code
Answers
Know the answer? Post it. Somebody with the same question will find it here.