Haber he modifcado cosas y ahora no me da error pero aun así el mouse se mueve hacia las coordenadaas.
private const int MOUSEEVENTF_LEFTDOWN = 0x0002;
private const int MOUSEEVENTF_MOVE = 0x0001;
private const int MOUSEEVENTF_ABSOLUTE = 0x8000;
private const int MOUSEEVENTF_LEFTUP = 0x0004;
int x = Convert.ToInt16(textBox1.Text);
int y = Convert.ToInt16(textBox2.Text);
// Coordenadas del cursor
Cursor.Position = new Point(x,y);
mouse_event(MOUSEEVENTF_LEFTUP | MOUSEEVENTF_MOVE | MOUSEEVENTF_ABSOLUTE, x,y, 0, 0);
mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
int PosX = ((x * 65535) / Screen.PrimaryScreen.Bounds.Width);
int PosY = ((y * 65535) / Screen.PrimaryScreen.Bounds.Height);
mouse_event(MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MOVE | MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_LEFTUP,x, y, 0,0 );
Point cursor = new Point();
GetCursorPos(out cursor);
int x = cursor.X;
int y = cursor.Y;
label1.Text = x.ToString();
label2.Text = y.ToString();
if (GetAsyncKeyState(Keys.F2) == -32767)
{
timer1.Start();
}
if (GetAsyncKeyState(Keys.F3) == -32767)
{
timer1.Stop();
}
if (GetAsyncKeyState(Keys.F4) == -32767)
{
textBox1.Text = x.ToString();
textBox2.Text = y.ToString();
}
}
Haber si puedes encontrar el problema
Tengo otro problema cuando le asigno a Move0x0001
se me va el mouse a una esquina