public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
[System.Runtime.InteropServices.DllImport("user32.dll")]
public static extern void mouse_event(int dwFlags, int dX, int dY, int cButtons, int dwExtraInfo);
public const int MOUSEEVENTF_RIGHTDOWN = 0x08;
public const int MOUSEEVENTF_RIGHTUP = 0x10;
public static void rightClick()
{
int xPos = Cursor.Position.X;
int yPos = Cursor.Position.Y;
mouse_event(MOUSEEVENTF_RIGHTDOWN, xPos, yPos, 0, 0);
mouse_event(MOUSEEVENTF_RIGHTUP, xPos, yPos, 0, 0);
}
private void button1_Click(object sender, EventArgs e)
{
SendKeys.Send("(3)");
rightClick();
SendKeys.Send("(1)");
}
}