ClipCursor: курсор не удерживается в заданных координатах - C#
Формулировка задачи:
Хотел подключить функцию ClipCursor.
Написал вот такой код:
Мышь он перемещает, но не держит. Что делать?
[DllImport("user32.dll")]
private static extern bool RegisterHotKey(IntPtr hWnd, int id, uint fsModifiers, int vk);
[DllImport("user32.dll")]
private static extern bool UnregisterHotKey(IntPtr hWnd, int id);
[DllImport("user32.dll")]
private static extern int SendMessage(int hWnd, int hMsg, int wParam, int lParam);
[DllImport("user32.dll")]
unsafe private static extern bool ClipCursor(Rectangle *rect);
public Form1()
{
InitializeComponent();
RegisterHotKey(this.Handle, 1, 0, 0x46); //HotKey - F
unsafe
{
Rectangle block = new Rectangle(0, 0, 100, 200);
Rectangle* rect = █
ClipCursor(rect);
}
}Решение задачи: «ClipCursor: курсор не удерживается в заданных координатах»
textual
Листинг программы
Cursor.Clip = this.Bounds;