C# Mouse Click Error

  • Thread starter Thread starter KFK_Wolf
  • Start date Start date
K

KFK_Wolf

Guest
[DllImport("user32.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)]
public static extern void mouse_event(uint dwFlags, uint dx, uint dy, uint cButtons, uint dwExtraInfo);

private const int MOUSEEVENTF_LEFTDOWN_C = 0x0002;
private const int MOUSEEVENTF_LEFTUP_C = 0x0004;
private const int MOUSEEVENTF_RIGHTDOWN_C = 0x08;
private const int MOUSEEVENTF_RIGHTUP_C = 0x10;
public static void DoMouseLeftClick(System.Drawing.Point Base)
{
uint X = (uint)Base.X;
uint Y = (uint)Base.Y;
mouse_event(MOUSEEVENTF_LEFTDOWN_C, X, Y, 0, 0);
mouse_event(MOUSEEVENTF_LEFTUP_C, X, Y, 0, 0);
}

public static void DoMouseRightClick(System.Drawing.Point Base)
{
uint X = (uint)Base.X;
uint Y = (uint)Base.Y;
//mouse_event(MOUSEEVENTF_RIGHTDOWN_C | MOUSEEVENTF_RIGHTUP_C, X, Y, 0, 0);
mouse_event(MOUSEEVENTF_RIGHTDOWN_C, X, Y, 0, 0);
mouse_event(MOUSEEVENTF_RIGHTUP_C, X, Y, 0, 0);
}

is not work My Run Function

DoMouseLeftClick(new Point(500,500));

Continue reading...
 
Back
Top