/// <summary> /// Synthesizies right mouse button click at the current cursor position /// </summary> public static void SendRightMouseClick() { INPUTMOUSE im = new INPUTMOUSE(); im.type = INPUTTYPE.INPUT_MOUSE; //Sends MOUSEEVENTF_RIGHTDOWN im.mi.dwFlags = MOUSEEVENTFLAGS.MOUSEEVENTF_RIGHTDOWN; SendInput(( uint )1, ref im, Marshal.SizeOf(im)); //Sends MOUSEEVENTF_RIGHTUP im.mi.dwFlags = MOUSEEVENTFLAGS.MOUSEEVENTF_RIGHTUP; SendInput(( uint )1, ref im, Marshal.SizeOf(im)); }
private static extern uint SendInput(uint nInputs, ref INPUTMOUSE pInputs, int cbSize);