Created
February 11, 2015 15:27
-
-
Save SteGriff/051ca634ee9083b539d0 to your computer and use it in GitHub Desktop.
Hide the mouse in Windows CE by moving it off-screen
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Runtime.InteropServices; | |
namespace MyProject.Classes | |
{ | |
public static class WinApi | |
{ | |
[DllImport("coredll.dll", SetLastError = true)] | |
private static extern void mouse_event(uint dwFlags, uint dx, uint dy, uint dwData, int dwExtraInfo); | |
private enum MouseFlags | |
{ | |
MOUSEEVENTF_ABSOLUTE = 0x8000, | |
MOUSEEVENTF_LEFTDOWN = 0x0002, | |
MOUSEEVENTF_LEFTUP = 0x0004, | |
MOUSEEVENTF_MIDDLEDOWN = 0x0020, | |
MOUSEEVENTF_MIDDLEUP = 0x0040, | |
MOUSEEVENTF_MOVE = 0x0001, | |
MOUSEEVENTF_RIGHTDOWN = 0x0008, | |
MOUSEEVENTF_RIGHTUP = 0x0010, | |
MOUSEEVENTF_WHEEL = 0x0800, | |
MOUSEEVENTF_XDOWN = 0x0080, | |
MOUSEEVENTF_XUP = 0x0100 | |
} | |
public static void MoveMouseOffScreen() | |
{ | |
WinApi.mouse_event( | |
(int)WinApi.MouseFlags.MOUSEEVENTF_MOVE | (int)WinApi.MouseFlags.MOUSEEVENTF_ABSOLUTE, | |
65535, | |
65535, | |
0, | |
0); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Sources:
Tested in Windows CE 6.0 on ARM
Usage: