I know how to change the cursor position from examples on MSDN.
My question is how to check the position of the mouse while moving the mouse, and then print the X and Y positions to represent the labels?
EDIT: Suppose I want to track the position of the mouse from across the screen.
EDIT 2: My application will be on the back / minimized.
I already use Mouse Hooks:
namespace Program { public partial class MouseHook { [DllImport("user32.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)] private static extern void mouse_event(int dwFlags, int dx, int dy, int dwData, IntPtr dwExtraInfo); private const int MOUSEEVENTF_LEFTDOWN = 0x02; private const int MOUSEEVENTF_LEFTUP = 0x04; private const int MOUSEEVENTF_RIGHTDOWN = 0x08; private const int MOUSEEVENTF_RIGHTUP = 0x10; public void DoMouseClick() { int X = Cursor.Position.X; int Y = Cursor.Position.Y; IntPtr newP = new IntPtr(Convert.ToInt64("0", 16)); mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_LEFTUP, X, Y, 0, newP); } } }
source share