diff --git a/src/FlaUI.Core/ActionDisposable.cs b/src/FlaUI.Core/ActionDisposable.cs new file mode 100644 index 000000000..188dbd72d --- /dev/null +++ b/src/FlaUI.Core/ActionDisposable.cs @@ -0,0 +1,31 @@ +using System; +using System.Threading; + +namespace FlaUI.Core +{ + /// + /// An implementation that executes an upon disposal. + /// + public class ActionDisposable : IDisposable + { + private volatile Action disposeAction; + + /// + /// Constructs a new disposable with the given action used for disposal. + /// + /// The action that is called upon disposal. + public ActionDisposable(Action disposeAction) + { + this.disposeAction = disposeAction; + } + + /// + /// Calls the defined . + /// + public void Dispose() + { + // Set the action to null to make sure it is only called once + Interlocked.Exchange(ref disposeAction, null)?.Invoke(); + } + } +} diff --git a/src/FlaUI.Core/Capturing/Capture.cs b/src/FlaUI.Core/Capturing/Capture.cs index 6285a6489..cec1c1867 100644 --- a/src/FlaUI.Core/Capturing/Capture.cs +++ b/src/FlaUI.Core/Capturing/Capture.cs @@ -102,11 +102,11 @@ public static CaptureImage Rectangle(Rectangle bounds, CaptureSettings settings private static Rectangle GetBoundsByScreenIndex(int screenIndex) { var monitors = new List(); - User32.EnumDisplayMonitors(IntPtr.Zero, IntPtr.Zero, MonitorDelegate , IntPtr.Zero); + User32.EnumDisplayMonitors(IntPtr.Zero, IntPtr.Zero, MonitorDelegate, IntPtr.Zero); var monitorRect = monitors[screenIndex].monitor; return new Rectangle(monitorRect.left, monitorRect.top, monitorRect.right - monitorRect.left, monitorRect.bottom - monitorRect.top); - - bool MonitorDelegate(IntPtr hMonitor, IntPtr hdcMonitor, ref Rect lprcMonitor, IntPtr dwData) + + bool MonitorDelegate(IntPtr hMonitor, IntPtr hdcMonitor, ref RECT lprcMonitor, IntPtr dwData) { var mi = new MonitorInfo(); mi.size = (uint)Marshal.SizeOf(mi); diff --git a/src/FlaUI.Core/Input/Keyboard.cs b/src/FlaUI.Core/Input/Keyboard.cs index 50c25c030..f372e9f9f 100644 --- a/src/FlaUI.Core/Input/Keyboard.cs +++ b/src/FlaUI.Core/Input/Keyboard.cs @@ -192,7 +192,18 @@ public static void ReleaseVirtualKeyCode(ushort virtualKeyCode) /// public static IDisposable Pressing(params VirtualKeyShort[] virtualKeys) { - return new KeyPressingActivation(virtualKeys); + foreach (var key in virtualKeys) + { + Press(key); + } + + return new ActionDisposable(() => + { + foreach (var key in virtualKeys.Reverse()) + { + Release(key); + } + }); } /// @@ -257,31 +268,5 @@ private static void SendInput(ushort keyCode, bool isKeyDown, bool isScanCode, b Logger.Default.Warn("Could not send keyboard input. ErrorCode: {0}", errorCode); } } - - /// - /// Disposable class which presses the keys on creation - /// and disposes them on destruction. - /// - private class KeyPressingActivation : IDisposable - { - private readonly VirtualKeyShort[] _virtualKeys; - - public KeyPressingActivation(VirtualKeyShort[] virtualKeys) - { - _virtualKeys = virtualKeys; - foreach (var key in _virtualKeys) - { - Press(key); - } - } - - public void Dispose() - { - foreach (var key in _virtualKeys.Reverse()) - { - Release(key); - } - } - } } } diff --git a/src/FlaUI.Core/WindowsAPI/Constants.cs b/src/FlaUI.Core/WindowsAPI/Constants.cs index edccf4452..016a7db8a 100644 --- a/src/FlaUI.Core/WindowsAPI/Constants.cs +++ b/src/FlaUI.Core/WindowsAPI/Constants.cs @@ -1,2112 +1,2112 @@ -using System; - -// ReSharper disable InconsistentNaming -#pragma warning disable -namespace FlaUI.Core.WindowsAPI -{ - public static class CommonHresultValues - { - public const long S_OK = 0x00000000; // Operation successful - public const long E_ABORT = 0x80004004; // Operation aborted - public const long E_ACCESSDENIED = 0x80070005; // General access denied error - public const long E_FAIL = 0x80004005; // Unspecified failure - public const long E_HANDLE = 0x80070006; // Handle that is not valid - public const long E_INVALIDARG = 0x80070057; // One or more arguments are not valid - public const long E_NOINTERFACE = 0x80004002; // No such interface supported - public const long E_NOTIMPL = 0x80004001; // Not implemented - public const long E_OUTOFMEMORY = 0x8007000E; // Failed to allocate necessary memory - public const long E_POINTER = 0x80004003; // Pointer that is not valid - public const long E_UNEXPECTED = 0x8000FFFF; // Unexpected failure - } - - public static class WindowsMessages - { - public const uint WM_ACTIVATE = 0x0006; - public const uint WM_ACTIVATEAPP = 0x001C; - public const uint WM_AFXFIRST = 0x0360; - public const uint WM_AFXLAST = 0x037F; - public const uint WM_APP = 0x8000; - public const uint WM_APPCOMMAND = 0x0319; - public const uint WM_ASKCBFORMATNAME = 0x030C; - public const uint WM_CANCELJOURNAL = 0x004B; - public const uint WM_CANCELMODE = 0x001F; - public const uint WM_CAPTURECHANGED = 0x0215; - public const uint WM_CHANGECBCHAIN = 0x030D; - public const uint WM_CHANGEUISTATE = 0x0127; - public const uint WM_CHAR = 0x0102; - public const uint WM_CHARTOITEM = 0x002F; - public const uint WM_CHILDACTIVATE = 0x0022; - public const uint WM_CLEAR = 0x0303; - public const uint WM_CLOSE = 0x0010; - public const uint WM_COMMAND = 0x0111; - public const uint WM_COMMNOTIFY = 0x0044; - public const uint WM_COMPACTING = 0x0041; - public const uint WM_COMPAREITEM = 0x0039; - public const uint WM_CONTEXTMENU = 0x007B; - public const uint WM_COPY = 0x0301; - public const uint WM_COPYDATA = 0x004A; - public const uint WM_CREATE = 0x0001; - public const uint WM_CTLCOLORBTN = 0x0135; - public const uint WM_CTLCOLORDLG = 0x0136; - public const uint WM_CTLCOLOREDIT = 0x0133; - public const uint WM_CTLCOLORLISTBOX = 0x0134; - public const uint WM_CTLCOLORMSGBOX = 0x0132; - public const uint WM_CTLCOLORSCROLLBAR = 0x0137; - public const uint WM_CTLCOLORSTATIC = 0x0138; - public const uint WM_CUT = 0x0300; - public const uint WM_DEADCHAR = 0x0103; - public const uint WM_DELETEITEM = 0x002D; - public const uint WM_DESTROY = 0x0002; - public const uint WM_DESTROYCLIPBOARD = 0x0307; - public const uint WM_DEVICECHANGE = 0x0219; - public const uint WM_DEVMODECHANGE = 0x001B; - public const uint WM_DISPLAYCHANGE = 0x007E; - public const uint WM_DRAWCLIPBOARD = 0x0308; - public const uint WM_DRAWITEM = 0x002B; - public const uint WM_DROPFILES = 0x0233; - public const uint WM_ENABLE = 0x000A; - public const uint WM_ENDSESSION = 0x0016; - public const uint WM_ENTERIDLE = 0x0121; - public const uint WM_ENTERMENULOOP = 0x0211; - public const uint WM_ENTERSIZEMOVE = 0x0231; - public const uint WM_ERASEBKGND = 0x0014; - public const uint WM_EXITMENULOOP = 0x0212; - public const uint WM_EXITSIZEMOVE = 0x0232; - public const uint WM_FONTCHANGE = 0x001D; - public const uint WM_GETDLGCODE = 0x0087; - public const uint WM_GETFONT = 0x0031; - public const uint WM_GETHOTKEY = 0x0033; - public const uint WM_GETICON = 0x007F; - public const uint WM_GETMINMAXINFO = 0x0024; - public const uint WM_GETOBJECT = 0x003D; - public const uint WM_GETTEXT = 0x000D; - public const uint WM_GETTEXTLENGTH = 0x000E; - public const uint WM_HANDHELDFIRST = 0x0358; - public const uint WM_HANDHELDLAST = 0x035F; - public const uint WM_HELP = 0x0053; - public const uint WM_HOTKEY = 0x0312; - public const uint WM_HSCROLL = 0x0114; - public const uint WM_HSCROLLCLIPBOARD = 0x030E; - public const uint WM_ICONERASEBKGND = 0x0027; - public const uint WM_IME_CHAR = 0x0286; - public const uint WM_IME_COMPOSITION = 0x010F; - public const uint WM_IME_COMPOSITIONFULL = 0x0284; - public const uint WM_IME_CONTROL = 0x0283; - public const uint WM_IME_ENDCOMPOSITION = 0x010E; - public const uint WM_IME_KEYDOWN = 0x0290; - public const uint WM_IME_KEYLAST = 0x010F; - public const uint WM_IME_KEYUP = 0x0291; - public const uint WM_IME_NOTIFY = 0x0282; - public const uint WM_IME_REQUEST = 0x0288; - public const uint WM_IME_SELECT = 0x0285; - public const uint WM_IME_SETCONTEXT = 0x0281; - public const uint WM_IME_STARTCOMPOSITION = 0x010D; - public const uint WM_INITDIALOG = 0x0110; - public const uint WM_INITMENU = 0x0116; - public const uint WM_INITMENUPOPUP = 0x0117; - public const uint WM_INPUT = 0x00FF; - public const uint WM_INPUTLANGCHANGE = 0x0051; - public const uint WM_INPUTLANGCHANGEREQUEST = 0x0050; - public const uint WM_KEYDOWN = 0x0100; - public const uint WM_KEYFIRST = 0x0100; - public const uint WM_KEYLAST = 0x0109; - public const uint WM_KEYUP = 0x0101; - public const uint WM_KILLFOCUS = 0x0008; - public const uint WM_LBUTTONDBLCLK = 0x0203; - public const uint WM_LBUTTONDOWN = 0x0201; - public const uint WM_LBUTTONUP = 0x0202; - public const uint WM_MBUTTONDBLCLK = 0x0209; - public const uint WM_MBUTTONDOWN = 0x0207; - public const uint WM_MBUTTONUP = 0x0208; - public const uint WM_MDIACTIVATE = 0x0222; - public const uint WM_MDICASCADE = 0x0227; - public const uint WM_MDICREATE = 0x0220; - public const uint WM_MDIDESTROY = 0x0221; - public const uint WM_MDIGETACTIVE = 0x0229; - public const uint WM_MDIICONARRANGE = 0x0228; - public const uint WM_MDIMAXIMIZE = 0x0225; - public const uint WM_MDINEXT = 0x0224; - public const uint WM_MDIREFRESHMENU = 0x0234; - public const uint WM_MDIRESTORE = 0x0223; - public const uint WM_MDISETMENU = 0x0230; - public const uint WM_MDITILE = 0x0226; - public const uint WM_MEASUREITEM = 0x002C; - public const uint WM_MENUCHAR = 0x0120; - public const uint WM_MENUCOMMAND = 0x0126; - public const uint WM_MENUDRAG = 0x0123; - public const uint WM_MENUGETOBJECT = 0x0124; - public const uint WM_MENURBUTTONUP = 0x0122; - public const uint WM_MENUSELECT = 0x011F; - public const uint WM_MOUSEACTIVATE = 0x0021; - public const uint WM_MOUSEFIRST = 0x0200; - public const uint WM_MOUSEHOVER = 0x02A1; - public const uint WM_MOUSELAST = 0x020D; // Win95: 0x0209, WinNT4,98: 0x020A - public const uint WM_MOUSELEAVE = 0x02A3; - public const uint WM_MOUSEMOVE = 0x0200; - public const uint WM_MOUSEWHEEL = 0x020A; - public const uint WM_MOVE = 0x0003; - public const uint WM_MOVING = 0x0216; - public const uint WM_NCACTIVATE = 0x0086; - public const uint WM_NCCALCSIZE = 0x0083; - public const uint WM_NCCREATE = 0x0081; - public const uint WM_NCDESTROY = 0x0082; - public const uint WM_NCHITTEST = 0x0084; - public const uint WM_NCLBUTTONDBLCLK = 0x00A3; - public const uint WM_NCLBUTTONDOWN = 0x00A1; - public const uint WM_NCLBUTTONUP = 0x00A2; - public const uint WM_NCMBUTTONDBLCLK = 0x00A9; - public const uint WM_NCMBUTTONDOWN = 0x00A7; - public const uint WM_NCMBUTTONUP = 0x00A8; - public const uint WM_NCMOUSEHOVER = 0x02A0; - public const uint WM_NCMOUSELEAVE = 0x02A2; - public const uint WM_NCMOUSEMOVE = 0x00A0; - public const uint WM_NCPAINT = 0x0085; - public const uint WM_NCRBUTTONDBLCLK = 0x00A6; - public const uint WM_NCRBUTTONDOWN = 0x00A4; - public const uint WM_NCRBUTTONUP = 0x00A5; - public const uint WM_NCXBUTTONDBLCLK = 0x00AD; - public const uint WM_NCXBUTTONDOWN = 0x00AB; - public const uint WM_NCXBUTTONUP = 0x00AC; - public const uint WM_NEXTDLGCTL = 0x0028; - public const uint WM_NEXTMENU = 0x0213; - public const uint WM_NOTIFY = 0x004E; - public const uint WM_NOTIFYFORMAT = 0x0055; - public const uint WM_NULL = 0x0000; - public const uint WM_PAINT = 0x000F; - public const uint WM_PAINTCLIPBOARD = 0x0309; - public const uint WM_PAINTICON = 0x0026; - public const uint WM_PALETTECHANGED = 0x0311; - public const uint WM_PALETTEISCHANGING = 0x0310; - public const uint WM_PARENTNOTIFY = 0x0210; - public const uint WM_PASTE = 0x0302; - public const uint WM_PENWINFIRST = 0x0380; - public const uint WM_PENWINLAST = 0x038F; - public const uint WM_POWER = 0x0048; - public const uint WM_POWERBROADCAST = 0x0218; - public const uint WM_PRINT = 0x0317; - public const uint WM_PRINTCLIENT = 0x0318; - public const uint WM_QUERYDRAGICON = 0x0037; - public const uint WM_QUERYENDSESSION = 0x0011; - public const uint WM_QUERYNEWPALETTE = 0x030F; - public const uint WM_QUERYOPEN = 0x0013; - public const uint WM_QUERYUISTATE = 0x0129; - public const uint WM_QUEUESYNC = 0x0023; - public const uint WM_QUIT = 0x0012; - public const uint WM_RBUTTONDBLCLK = 0x0206; - public const uint WM_RBUTTONDOWN = 0x0204; - public const uint WM_RBUTTONUP = 0x0205; - public const uint WM_RENDERALLFORMATS = 0x0306; - public const uint WM_RENDERFORMAT = 0x0305; - public const uint WM_SETCURSOR = 0x0020; - public const uint WM_SETFOCUS = 0x0007; - public const uint WM_SETFONT = 0x0030; - public const uint WM_SETHOTKEY = 0x0032; - public const uint WM_SETICON = 0x0080; - public const uint WM_SETREDRAW = 0x000B; - public const uint WM_SETTEXT = 0x000C; - public const uint WM_SETTINGCHANGE = 0x001A; - public const uint WM_SHOWWINDOW = 0x0018; - public const uint WM_SIZE = 0x0005; - public const uint WM_SIZECLIPBOARD = 0x030B; - public const uint WM_SIZING = 0x0214; - public const uint WM_SPOOLERSTATUS = 0x002A; - public const uint WM_STYLECHANGED = 0x007D; - public const uint WM_STYLECHANGING = 0x007C; - public const uint WM_SYNCPAINT = 0x0088; - public const uint WM_SYSCHAR = 0x0106; - public const uint WM_SYSCOLORCHANGE = 0x0015; - public const uint WM_SYSCOMMAND = 0x0112; - public const uint WM_SYSDEADCHAR = 0x0107; - public const uint WM_SYSKEYDOWN = 0x0104; - public const uint WM_SYSKEYUP = 0x0105; - public const uint WM_TABLET_FIRST = 0x02C0; - public const uint WM_TABLET_LAST = 0x02DF; - public const uint WM_TCARD = 0x0052; - public const uint WM_THEMECHANGED = 0x031A; - public const uint WM_TIMECHANGE = 0x001E; - public const uint WM_TIMER = 0x0113; - public const uint WM_UNDO = 0x0304; - public const uint WM_UNICHAR = 0x0109; - public const uint WM_UNINITMENUPOPUP = 0x0125; - public const uint WM_UPDATEUISTATE = 0x0128; - public const uint WM_USER = 0x0400; - public const uint WM_USERCHANGED = 0x0054; - public const uint WM_VKEYTOITEM = 0x002E; - public const uint WM_VSCROLL = 0x0115; - public const uint WM_VSCROLLCLIPBOARD = 0x030A; - public const uint WM_WINDOWPOSCHANGED = 0x0047; - public const uint WM_WINDOWPOSCHANGING = 0x0046; - public const uint WM_WININICHANGE = 0x001A; - public const uint WM_WTSSESSION_CHANGE = 0x02B1; - public const uint WM_XBUTTONDBLCLK = 0x020D; - public const uint WM_XBUTTONDOWN = 0x020B; - public const uint WM_XBUTTONUP = 0x020C; - } - - public static class WindowLongParam - { - public const int GWL_WNDPROC = -4; - public const int GWL_HINSTANCE = -6; - public const int GWL_HWNDPARENT = -8; - public const int GWL_STYLE = -16; - public const int GWL_EXSTYLE = -20; - public const int GWL_USERDATA = -21; - public const int GWL_ID = -12; - } - - public static class WindowStyles - { - public const uint WS_OVERLAPPED = 0x00000000; - public const uint WS_POPUP = 0x80000000; - public const uint WS_CHILD = 0x40000000; - public const uint WS_MINIMIZE = 0x20000000; - public const uint WS_VISIBLE = 0x10000000; - public const uint WS_DISABLED = 0x08000000; - public const uint WS_CLIPSIBLINGS = 0x04000000; - public const uint WS_CLIPCHILDREN = 0x02000000; - public const uint WS_MAXIMIZE = 0x01000000; - public const uint WS_CAPTION = 0x00C00000; /* WS_BORDER | WS_DLGFRAME */ - public const uint WS_BORDER = 0x00800000; - public const uint WS_DLGFRAME = 0x00400000; - public const uint WS_VSCROLL = 0x00200000; - public const uint WS_HSCROLL = 0x00100000; - public const uint WS_SYSMENU = 0x00080000; - public const uint WS_THICKFRAME = 0x00040000; - public const uint WS_GROUP = 0x00020000; - public const uint WS_TABSTOP = 0x00010000; - - public const uint WS_MINIMIZEBOX = 0x00020000; - public const uint WS_MAXIMIZEBOX = 0x00010000; - - public const uint WS_TILED = WS_OVERLAPPED; - public const uint WS_ICONIC = WS_MINIMIZE; - public const uint WS_SIZEBOX = WS_THICKFRAME; - public const uint WS_TILEDWINDOW = WS_OVERLAPPEDWINDOW; - - // Common Window Styles - public const uint WS_OVERLAPPEDWINDOW = WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX; - public const uint WS_POPUPWINDOW = WS_POPUP | WS_BORDER | WS_SYSMENU; - public const uint WS_CHILDWINDOW = WS_CHILD; - - //Extended Window Styles - public const uint WS_EX_DLGMODALFRAME = 0x00000001; - public const uint WS_EX_NOPARENTNOTIFY = 0x00000004; - public const uint WS_EX_TOPMOST = 0x00000008; - public const uint WS_EX_ACCEPTFILES = 0x00000010; - public const uint WS_EX_TRANSPARENT = 0x00000020; - - //#if(WINVER >= 0x0400) - public const uint WS_EX_MDICHILD = 0x00000040; - public const uint WS_EX_TOOLWINDOW = 0x00000080; - public const uint WS_EX_WINDOWEDGE = 0x00000100; - public const uint WS_EX_CLIENTEDGE = 0x00000200; - public const uint WS_EX_CONTEXTHELP = 0x00000400; - - public const uint WS_EX_RIGHT = 0x00001000; - public const uint WS_EX_LEFT = 0x00000000; - public const uint WS_EX_RTLREADING = 0x00002000; - public const uint WS_EX_LTRREADING = 0x00000000; - public const uint WS_EX_LEFTSCROLLBAR = 0x00004000; - public const uint WS_EX_RIGHTSCROLLBAR = 0x00000000; - - public const uint WS_EX_CONTROLPARENT = 0x00010000; - public const uint WS_EX_STATICEDGE = 0x00020000; - public const uint WS_EX_APPWINDOW = 0x00040000; - - public const uint WS_EX_OVERLAPPEDWINDOW = WS_EX_WINDOWEDGE | WS_EX_CLIENTEDGE; - public const uint WS_EX_PALETTEWINDOW = WS_EX_WINDOWEDGE | WS_EX_TOOLWINDOW | WS_EX_TOPMOST; - //#endif /* WINVER >= 0x0400 */ - - //#if(_WIN32_WINNT >= 0x0500) - public const uint WS_EX_LAYERED = 0x00080000; - //#endif /* _WIN32_WINNT >= 0x0500 */ - - //#if(WINVER >= 0x0500) - public const uint WS_EX_NOINHERITLAYOUT = 0x00100000; // Disable inheritance of mirroring by children - public const uint WS_EX_LAYOUTRTL = 0x00400000; // Right to left mirroring - //#endif /* WINVER >= 0x0500 */ - - //#if(_WIN32_WINNT >= 0x0500) - public const uint WS_EX_COMPOSITED = 0x02000000; - public const uint WS_EX_NOACTIVATE = 0x08000000; - //#endif /* _WIN32_WINNT >= 0x0500 */ - } - - public static class SetWindowPosFlags - { - public const int SWP_NOSIZE = 0x0001; - public const int SWP_NOMOVE = 0x0002; - public const int SWP_NOZORDER = 0x0004; - public const int SWP_NOREDRAW = 0x0008; - public const int SWP_NOACTIVATE = 0x0010; - public const int SWP_FRAMECHANGED = 0x0020; - public const int SWP_SHOWWINDOW = 0x0040; - public const int SWP_HIDEWINDOW = 0x0080; - public const int SWP_NOCOPYBITS = 0x0100; - public const int SWP_NOOWNERZORDER = 0x0200; - public const int SWP_DRAWFRAME = SWP_FRAMECHANGED; - public const int SWP_NOREPOSITION = SWP_NOOWNERZORDER; - public const int SWP_NOSENDCHANGING = 0x0400; - public const int SWP_DEFERERASE = 0x2000; - public const int SWP_ASYNCWINDOWPOS = 0x4000; - } - - public static class ShowWindowTypes - { - public const int SW_HIDE = 0; - public const int SW_SHOWNORMAL = 1; - public const int SW_NORMAL = 1; - public const int SW_SHOWMINIMIZED = 2; - public const int SW_SHOWMAXIMIZED = 3; - public const int SW_MAXIMIZE = 3; - public const int SW_SHOWNOACTIVATE = 4; - public const int SW_SHOW = 5; - public const int SW_MINIMIZE = 6; - public const int SW_SHOWMINNOACTIVE = 7; - public const int SW_SHOWNA = 8; - public const int SW_RESTORE = 9; - public const int SW_SHOWDEFAULT = 10; - public const int SW_FORCEMINIMIZE = 11; - public const int SW_MAX = 11; - } - - public static class LayeredWindowAttributes - { - public const uint LWA_COLORKEY = 0x1; - public const uint LWA_ALPHA = 0x2; - } - - public enum SystemMetric - { - /// - /// The flags that specify how the system arranged minimized windows. For more information, see the Remarks section in this topic. - /// - SM_ARRANGE = 56, - - /// - /// The value that specifies how the system is started: - /// 0 Normal boot - /// 1 Fail-safe boot - /// 2 Fail-safe with network boot - /// A fail-safe boot (also called SafeBoot, Safe Mode, or Clean Boot) bypasses the user startup files. - /// - SM_CLEANBOOT = 67, - - /// - /// The number of display monitors on a desktop. For more information, see the Remarks section in this topic. - /// - SM_CMONITORS = 80, - - /// - /// The number of buttons on a mouse, or zero if no mouse is installed. - /// - SM_CMOUSEBUTTONS = 43, - - /// - /// Reflects the state of the laptop or slate mode, 0 for Slate Mode and non-zero otherwise. When this system metric changes, the system sends a broadcast message via WM_SETTINGCHANGE with "ConvertibleSlateMode" in the LPARAM. Note that this system metric doesn't apply to desktop PCs. In that case, use GetAutoRotationState. - /// - SM_CONVERTIBLESLATEMODE = 0x2003, - - /// - /// The width of a window border, in pixels. This is equivalent to the SM_CXEDGE value for windows with the 3-D look. - /// - SM_CXBORDER = 5, - - /// - /// The width of a cursor, in pixels. The system cannot create cursors of other sizes. - /// - SM_CXCURSOR = 13, - - /// - /// This value is the same as SM_CXFIXEDFRAME. - /// - SM_CXDLGFRAME = 7, - - /// - /// The width of the rectangle around the location of a first click in a double-click sequence, in pixels. The second click must occur within the rectangle that is defined by SM_CXDOUBLECLK and SM_CYDOUBLECLK for the system to consider the two clicks a double-click. The two clicks must also occur within a specified time. - /// To set the width of the double-click rectangle, call SystemParametersInfo with SPI_SETDOUBLECLKWIDTH. - - /// - SM_CXDOUBLECLK = 36, - - /// - /// The number of pixels on either side of a mouse-down point that the mouse pointer can move before a drag operation begins. This allows the user to click and release the mouse button easily without unintentionally starting a drag operation. If this value is negative, it is subtracted from the left of the mouse-down point and added to the right of it. - /// - SM_CXDRAG = 68, - - /// - /// The width of a 3-D border, in pixels. This metric is the 3-D counterpart of SM_CXBORDER. - /// - SM_CXEDGE = 45, - - /// - /// The thickness of the frame around the perimeter of a window that has a caption but is not sizable, in pixels. SM_CXFIXEDFRAME is the height of the horizontal border, and SM_CYFIXEDFRAME is the width of the vertical border. - /// This value is the same as SM_CXDLGFRAME. - - /// - SM_CXFIXEDFRAME = 7, - - /// - /// The width of the left and right edges of the focus rectangle that the DrawFocusRect draws. This value is in pixels. - /// Windows 2000: This value is not supported. - - /// - SM_CXFOCUSBORDER = 83, - - /// - /// This value is the same as SM_CXSIZEFRAME. - /// - SM_CXFRAME = 32, - - /// - /// The width of the client area for a full-screen window on the primary display monitor, in pixels. To get the coordinates of the portion of the screen that is not obscured by the system taskbar or by application desktop toolbars, call the SystemParametersInfo function with the SPI_GETWORKAREA value. - /// - SM_CXFULLSCREEN = 16, - - /// - /// The width of the arrow bitmap on a horizontal scroll bar, in pixels. - /// - SM_CXHSCROLL = 21, - - /// - /// The width of the thumb box in a horizontal scroll bar, in pixels. - /// - SM_CXHTHUMB = 10, - - /// - /// The default width of an icon, in pixels. The LoadIcon function can load only icons with the dimensions that SM_CXICON and SM_CYICON specifies. - /// - SM_CXICON = 11, - - /// - /// The width of a grid cell for items in large icon view, in pixels. Each item fits into a rectangle of size SM_CXICONSPACING by SM_CYICONSPACING when arranged. This value is always greater than or equal to SM_CXICON. - /// - SM_CXICONSPACING = 38, - - /// - /// The default width, in pixels, of a maximized top-level window on the primary display monitor. - /// - SM_CXMAXIMIZED = 61, - - /// - /// The default maximum width of a window that has a caption and sizing borders, in pixels. This metric refers to the entire desktop. The user cannot drag the window frame to a size larger than these dimensions. A window can override this value by processing the WM_GETMINMAXINFO message. - /// - SM_CXMAXTRACK = 59, - - /// - /// The width of the default menu check-mark bitmap, in pixels. - /// - SM_CXMENUCHECK = 71, - - /// - /// The width of menu bar buttons, such as the child window close button that is used in the multiple document interface, in pixels. - /// - SM_CXMENUSIZE = 54, - - /// - /// The minimum width of a window, in pixels. - /// - SM_CXMIN = 28, - - /// - /// The width of a minimized window, in pixels. - /// - SM_CXMINIMIZED = 57, - - /// - /// The width of a grid cell for a minimized window, in pixels. Each minimized window fits into a rectangle this size when arranged. This value is always greater than or equal to SM_CXMINIMIZED. - /// - SM_CXMINSPACING = 47, - - /// - /// The minimum tracking width of a window, in pixels. The user cannot drag the window frame to a size smaller than these dimensions. A window can override this value by processing the WM_GETMINMAXINFO message. - /// - SM_CXMINTRACK = 34, - - /// - /// The amount of border padding for captioned windows, in pixels. - /// Windows XP/2000: This value is not supported. - - /// - SM_CXPADDEDBORDER = 92, - - /// - /// The width of the screen of the primary display monitor, in pixels. This is the same value obtained by calling GetDeviceCaps as follows: GetDeviceCaps( hdcPrimaryMonitor, HORZRES). - /// - SM_CXSCREEN = 0, - - /// - /// The width of a button in a window caption or title bar, in pixels. - /// - SM_CXSIZE = 30, - - /// - /// The thickness of the sizing border around the perimeter of a window that can be resized, in pixels. SM_CXSIZEFRAME is the width of the horizontal border, and SM_CYSIZEFRAME is the height of the vertical border. - /// This value is the same as SM_CXFRAME. - - /// - SM_CXSIZEFRAME = 32, - - /// - /// The recommended width of a small icon, in pixels. Small icons typically appear in window captions and in small icon view. - /// - SM_CXSMICON = 49, - - /// - /// The width of small caption buttons, in pixels. - /// - SM_CXSMSIZE = 52, - - /// - /// The width of the virtual screen, in pixels. The virtual screen is the bounding rectangle of all display monitors. The SM_XVIRTUALSCREEN metric is the coordinates for the left side of the virtual screen. - /// - SM_CXVIRTUALSCREEN = 78, - - /// - /// The width of a vertical scroll bar, in pixels. - /// - SM_CXVSCROLL = 2, - - /// - /// The height of a window border, in pixels. This is equivalent to the SM_CYEDGE value for windows with the 3-D look. - /// - SM_CYBORDER = 6, - - /// - /// The height of a caption area, in pixels. - /// - SM_CYCAPTION = 4, - - /// - /// The height of a cursor, in pixels. The system cannot create cursors of other sizes. - /// - SM_CYCURSOR = 14, - - /// - /// This value is the same as SM_CYFIXEDFRAME. - /// - SM_CYDLGFRAME = 8, - - /// - /// The height of the rectangle around the location of a first click in a double-click sequence, in pixels. The second click must occur within the rectangle defined by SM_CXDOUBLECLK and SM_CYDOUBLECLK for the system to consider the two clicks a double-click. The two clicks must also occur within a specified time. - /// To set the height of the double-click rectangle, call SystemParametersInfo with SPI_SETDOUBLECLKHEIGHT. - - /// - SM_CYDOUBLECLK = 37, - - /// - /// The number of pixels above and below a mouse-down point that the mouse pointer can move before a drag operation begins. This allows the user to click and release the mouse button easily without unintentionally starting a drag operation. If this value is negative, it is subtracted from above the mouse-down point and added below it. - /// - SM_CYDRAG = 69, - - /// - /// The height of a 3-D border, in pixels. This is the 3-D counterpart of SM_CYBORDER. - /// - SM_CYEDGE = 46, - - /// - /// The thickness of the frame around the perimeter of a window that has a caption but is not sizable, in pixels. SM_CXFIXEDFRAME is the height of the horizontal border, and SM_CYFIXEDFRAME is the width of the vertical border. - /// This value is the same as SM_CYDLGFRAME. - - /// - SM_CYFIXEDFRAME = 8, - - /// - /// The height of the top and bottom edges of the focus rectangle drawn by DrawFocusRect. This value is in pixels. - /// Windows 2000: This value is not supported. - - /// - SM_CYFOCUSBORDER = 84, - - /// - /// This value is the same as SM_CYSIZEFRAME. - /// - SM_CYFRAME = 33, - - /// - /// The height of the client area for a full-screen window on the primary display monitor, in pixels. To get the coordinates of the portion of the screen not obscured by the system taskbar or by application desktop toolbars, call the SystemParametersInfo function with the SPI_GETWORKAREA value. - /// - SM_CYFULLSCREEN = 17, - - /// - /// The height of a horizontal scroll bar, in pixels. - /// - SM_CYHSCROLL = 3, - - /// - /// The default height of an icon, in pixels. The LoadIcon function can load only icons with the dimensions SM_CXICON and SM_CYICON. - /// - SM_CYICON = 12, - - /// - /// The height of a grid cell for items in large icon view, in pixels. Each item fits into a rectangle of size SM_CXICONSPACING by SM_CYICONSPACING when arranged. This value is always greater than or equal to SM_CYICON. - /// - SM_CYICONSPACING = 39, - - /// - /// For double byte character set versions of the system, this is the height of the Kanji window at the bottom of the screen, in pixels. - /// - SM_CYKANJIWINDOW = 18, - - /// - /// The default height, in pixels, of a maximized top-level window on the primary display monitor. - /// - SM_CYMAXIMIZED = 62, - - /// - /// The default maximum height of a window that has a caption and sizing borders, in pixels. This metric refers to the entire desktop. The user cannot drag the window frame to a size larger than these dimensions. A window can override this value by processing the WM_GETMINMAXINFO message. - /// - SM_CYMAXTRACK = 60, - - /// - /// The height of a single-line menu bar, in pixels. - /// - SM_CYMENU = 15, - - /// - /// The height of the default menu check-mark bitmap, in pixels. - /// - SM_CYMENUCHECK = 72, - - /// - /// The height of menu bar buttons, such as the child window close button that is used in the multiple document interface, in pixels. - /// - SM_CYMENUSIZE = 55, - - /// - /// The minimum height of a window, in pixels. - /// - SM_CYMIN = 29, - - /// - /// The height of a minimized window, in pixels. - /// - SM_CYMINIMIZED = 58, - - /// - /// The height of a grid cell for a minimized window, in pixels. Each minimized window fits into a rectangle this size when arranged. This value is always greater than or equal to SM_CYMINIMIZED. - /// - SM_CYMINSPACING = 48, - - /// - /// The minimum tracking height of a window, in pixels. The user cannot drag the window frame to a size smaller than these dimensions. A window can override this value by processing the WM_GETMINMAXINFO message. - /// - SM_CYMINTRACK = 35, - - /// - /// The height of the screen of the primary display monitor, in pixels. This is the same value obtained by calling GetDeviceCaps as follows: GetDeviceCaps( hdcPrimaryMonitor, VERTRES). - /// - SM_CYSCREEN = 1, - - /// - /// The height of a button in a window caption or title bar, in pixels. - /// - SM_CYSIZE = 31, - - /// - /// The thickness of the sizing border around the perimeter of a window that can be resized, in pixels. SM_CXSIZEFRAME is the width of the horizontal border, and SM_CYSIZEFRAME is the height of the vertical border. - /// This value is the same as SM_CYFRAME. - - /// - SM_CYSIZEFRAME = 33, - - /// - /// The height of a small caption, in pixels. - /// - SM_CYSMCAPTION = 51, - - /// - /// The recommended height of a small icon, in pixels. Small icons typically appear in window captions and in small icon view. - /// - SM_CYSMICON = 50, - - /// - /// The height of small caption buttons, in pixels. - /// - SM_CYSMSIZE = 53, - - /// - /// The height of the virtual screen, in pixels. The virtual screen is the bounding rectangle of all display monitors. The SM_YVIRTUALSCREEN metric is the coordinates for the top of the virtual screen. - /// - SM_CYVIRTUALSCREEN = 79, - - /// - /// The height of the arrow bitmap on a vertical scroll bar, in pixels. - /// - SM_CYVSCROLL = 20, - - /// - /// The height of the thumb box in a vertical scroll bar, in pixels. - /// - SM_CYVTHUMB = 9, - - /// - /// Nonzero if User32.dll supports DBCS; otherwise, 0. - /// - SM_DBCSENABLED = 42, - - /// - /// Nonzero if the debug version of User.exe is installed; otherwise, 0. - /// - SM_DEBUG = 22, - - /// - /// Nonzero if the current operating system is Windows 7 or Windows Server 2008 R2 and the Tablet PC Input service is started; otherwise, 0. The return value is a bitmask that specifies the type of digitizer input supported by the device. For more information, see Remarks. - /// Windows Server 2008, Windows Vista and Windows XP/2000: This value is not supported. - /// - SM_DIGITIZER = 94, - - /// - /// Nonzero if Input Method Manager/Input Method Editor features are enabled; otherwise, 0. - /// SM_IMMENABLED indicates whether the system is ready to use a Unicode-based IME on a Unicode application. To ensure that a language-dependent IME works, check SM_DBCSENABLED and the system ANSI code page. Otherwise the ANSI-to-Unicode conversion may not be performed correctly, or some components like fonts or registry settings may not be present. - /// - SM_IMMENABLED = 82, - - /// - /// Nonzero if there are digitizers in the system; otherwise, 0. - /// SM_MAXIMUMTOUCHES returns the aggregate maximum of the maximum number of contacts supported by every digitizer in the system. If the system has only single-touch digitizers, the return value is 1. If the system has multi-touch digitizers, the return value is the number of simultaneous contacts the hardware can provide. - /// Windows Server 2008, Windows Vista and Windows XP/2000: This value is not supported. - /// - SM_MAXIMUMTOUCHES = 95, - - /// - /// Nonzero if the current operating system is the Windows XP, Media Center Edition, 0 if not. - /// - SM_MEDIACENTER = 87, - - /// - /// Nonzero if drop-down menus are right-aligned with the corresponding menu-bar item; 0 if the menus are left-aligned. - /// - SM_MENUDROPALIGNMENT = 40, - - /// - /// Nonzero if the system is enabled for Hebrew and Arabic languages, 0 if not. - /// - SM_MIDEASTENABLED = 74, - - /// - /// Nonzero if a mouse is installed; otherwise, 0. This value is rarely zero, because of support for virtual mice and because some systems detect the presence of the port instead of the presence of a mouse. - /// - SM_MOUSEPRESENT = 19, - - /// - /// Nonzero if a mouse with a horizontal scroll wheel is installed; otherwise 0. - /// - SM_MOUSEHORIZONTALWHEELPRESENT = 91, - - /// - /// Nonzero if a mouse with a vertical scroll wheel is installed; otherwise 0. - /// - SM_MOUSEWHEELPRESENT = 75, - - /// - /// The least significant bit is set if a network is present; otherwise, it is cleared. The other bits are reserved for future use. - /// - SM_NETWORK = 63, - - /// - /// Nonzero if the Microsoft Windows for Pen computing extensions are installed; zero otherwise. - /// - SM_PENWINDOWS = 41, - - /// - /// This system metric is used in a Terminal Services environment to determine if the current Terminal Server session is being remotely controlled. Its value is nonzero if the current session is remotely controlled; otherwise, 0. - /// You can use terminal services management tools such as Terminal Services Manager (tsadmin.msc) and shadow.exe to control a remote session. When a session is being remotely controlled, another user can view the contents of that session and potentially interact with it. - /// - SM_REMOTECONTROL = 0x2001, - - /// - /// This system metric is used in a Terminal Services environment. If the calling process is associated with a Terminal Services client session, the return value is nonzero. If the calling process is associated with the Terminal Services console session, the return value is 0. Windows Server 2003 and Windows XP: The console session is not necessarily the physical console. For more information, see WTSGetActiveConsoleSessionId. - /// - SM_REMOTESESSION = 0x1000, - - /// - /// Nonzero if all the display monitors have the same color format, otherwise, 0. Two displays can have the same bit depth, but different color formats. For example, the red, green, and blue pixels can be encoded with different numbers of bits, or those bits can be located in different places in a pixel color value. - /// - SM_SAMEDISPLAYFORMAT = 81, - - /// - /// This system metric should be ignored; it always returns 0. - /// - SM_SECURE = 44, - - /// - /// The build number if the system is Windows Server 2003 R2; otherwise, 0. - /// - SM_SERVERR2 = 89, - - /// - /// Nonzero if the user requires an application to present information visually in situations where it would otherwise present the information only in audible form; otherwise, 0. - /// - SM_SHOWSOUNDS = 70, - - /// - /// Nonzero if the current session is shutting down; otherwise, 0. - /// Windows 2000: This value is not supported. - /// - SM_SHUTTINGDOWN = 0x2000, - - /// - /// Nonzero if the computer has a low-end (slow) processor; otherwise, 0. - /// - SM_SLOWMACHINE = 73, - - /// - /// Nonzero if the current operating system is Windows 7 Starter Edition, Windows Vista Starter, or Windows XP Starter Edition; otherwise, 0. - /// - SM_STARTER = 88, - - /// - /// Nonzero if the meanings of the left and right mouse buttons are swapped; otherwise, 0. - /// - SM_SWAPBUTTON = 23, - - /// - /// Reflects the state of the docking mode, 0 for Undocked Mode and non-zero otherwise. When this system metric changes, the system sends a broadcast message via WM_SETTINGCHANGE with "SystemDockMode" in the LPARAM. - /// - SM_SYSTEMDOCKED = 0x2004, - - /// - /// Nonzero if the current operating system is the Windows XP Tablet PC edition or if the current operating system is Windows Vista or Windows 7 and the Tablet PC Input service is started; otherwise, 0. The SM_DIGITIZER setting indicates the type of digitizer input supported by a device running Windows 7 or Windows Server 2008 R2. For more information, see Remarks. - /// - SM_TABLETPC = 86, - - /// - /// The coordinates for the left side of the virtual screen. The virtual screen is the bounding rectangle of all display monitors. The SM_CXVIRTUALSCREEN metric is the width of the virtual screen. - /// - SM_XVIRTUALSCREEN = 76, - - /// - /// The coordinates for the top of the virtual screen. The virtual screen is the bounding rectangle of all display monitors. The SM_CYVIRTUALSCREEN metric is the height of the virtual screen. - /// - SM_YVIRTUALSCREEN = 77 - } - - public enum InputType : uint - { - INPUT_MOUSE = 0, - INPUT_KEYBOARD = 1, - INPUT_HARDWARE = 2 - } - - [Flags] - public enum MouseEventFlags : uint - { - MOUSEEVENTF_MOVE = 0x0001, - MOUSEEVENTF_LEFTDOWN = 0x0002, - MOUSEEVENTF_LEFTUP = 0x0004, - MOUSEEVENTF_RIGHTDOWN = 0x0008, - MOUSEEVENTF_RIGHTUP = 0x0010, - MOUSEEVENTF_MIDDLEDOWN = 0x0020, - MOUSEEVENTF_MIDDLEUP = 0x0040, - MOUSEEVENTF_XDOWN = 0x0080, - MOUSEEVENTF_XUP = 0x0100, - MOUSEEVENTF_WHEEL = 0x0800, - MOUSEEVENTF_HWHEEL = 0x1000, // >= Win Vista only - MOUSEEVENTF_MOVE_NOCOALESCE = 0x2000, - MOUSEEVENTF_VIRTUALDESK = 0x4000, - MOUSEEVENTF_ABSOLUTE = 0x8000 - } - - [Flags] - public enum MouseEventDataXButtons : uint - { - NOTHING = 0x00000000, - XBUTTON1 = 0x00000001, - XBUTTON2 = 0x00000002 - } - - [Flags] - public enum VkKeyScanModifiers : byte - { - NONE = 0, - SHIFT = 0x01, - CONTROL = 0x02, - ALT = 0x04, - Hankaku = 0x08, - Reserved1 = 0x10, - Reserved2 = 0x20 - } - - public enum VirtualKeyShort : ushort - { - /// - /// Left mouse button - /// - LBUTTON = 0x01, - - /// - /// Right mouse button - /// - RBUTTON = 0x02, - - /// - /// Control-break processing - /// - CANCEL = 0x03, - - /// - /// Middle mouse button (three-button mouse) - /// - MBUTTON = 0x04, - - /// - /// Windows 2000/XP: X1 mouse button - /// - XBUTTON1 = 0x05, - - /// - /// Windows 2000/XP: X2 mouse button - /// - XBUTTON2 = 0x06, - - /// - /// BACKSPACE key - /// - BACK = 0x08, - - /// - /// TAB key - /// - TAB = 0x09, - - /// - /// CLEAR key - /// - CLEAR = 0x0C, - - /// - /// ENTER key - /// - RETURN = 0x0D, - ENTER = RETURN, - - /// - /// SHIFT key - /// - SHIFT = 0x10, - - /// - /// CTRL key - /// - CONTROL = 0x11, - - /// - /// ALT key - /// - ALT = 0x12, - - /// - /// PAUSE key - /// - PAUSE = 0x13, - - /// - /// CAPS LOCK key - /// - CAPITAL = 0x14, - CAPSLOCK = CAPITAL, - - /// - /// Input Method Editor (IME) Kana mode - /// - KANA = 0x15, - - /// - /// IME Hangul mode - /// - HANGUL = 0x15, - - /// - /// IME Junja mode - /// - JUNJA = 0x17, - - /// - /// IME final mode - /// - FINAL = 0x18, - - /// - /// IME Hanja mode - /// - HANJA = 0x19, - - /// - /// IME Kanji mode - /// - KANJI = 0x19, - - /// - /// ESC key - /// - ESCAPE = 0x1B, - ESC = ESCAPE, - - /// - /// IME convert - /// - CONVERT = 0x1C, - - /// - /// IME nonconvert - /// - NONCONVERT = 0x1D, - - /// - /// IME accept - /// - ACCEPT = 0x1E, - - /// - /// IME mode change request - /// - MODECHANGE = 0x1F, - - /// - /// SPACEBAR - /// - SPACE = 0x20, - - /// - /// PAGE UP key - /// - PRIOR = 0x21, - - /// - /// PAGE DOWN key - /// - NEXT = 0x22, - - /// - /// END key - /// - END = 0x23, - - /// - /// HOME key - /// - HOME = 0x24, - - /// - /// LEFT ARROW key - /// - LEFT = 0x25, - - /// - /// UP ARROW key - /// - UP = 0x26, - - /// - /// RIGHT ARROW key - /// - RIGHT = 0x27, - - /// - /// DOWN ARROW key - /// - DOWN = 0x28, - - /// - /// SELECT key - /// - SELECT = 0x29, - - /// - /// PRINT key - /// - PRINT = 0x2A, - - /// - /// EXECUTE key - /// - EXECUTE = 0x2B, - - /// - /// PRINT SCREEN key - /// - SNAPSHOT = 0x2C, - - /// - /// INS key - /// - INSERT = 0x2D, - - /// - /// DEL key - /// - DELETE = 0x2E, - - /// - /// HELP key - /// - HELP = 0x2F, - - /// - /// 0 key - /// - KEY_0 = 0x30, - - /// - /// 1 key - /// - KEY_1 = 0x31, - - /// - /// 2 key - /// - KEY_2 = 0x32, - - /// - /// 3 key - /// - KEY_3 = 0x33, - - /// - /// 4 key - /// - KEY_4 = 0x34, - - /// - /// 5 key - /// - KEY_5 = 0x35, - - /// - /// 6 key - /// - KEY_6 = 0x36, - - /// - /// 7 key - /// - KEY_7 = 0x37, - - /// - /// 8 key - /// - KEY_8 = 0x38, - - /// - /// 9 key - /// - KEY_9 = 0x39, - - /// - /// A key - /// - KEY_A = 0x41, - - /// - /// B key - /// - KEY_B = 0x42, - - /// - /// C key - /// - KEY_C = 0x43, - - /// - /// D key - /// - KEY_D = 0x44, - - /// - /// E key - /// - KEY_E = 0x45, - - /// - /// F key - /// - KEY_F = 0x46, - - /// - /// G key - /// - KEY_G = 0x47, - - /// - /// H key - /// - KEY_H = 0x48, - - /// - /// I key - /// - KEY_I = 0x49, - - /// - /// J key - /// - KEY_J = 0x4A, - - /// - /// K key - /// - KEY_K = 0x4B, - - /// - /// L key - /// - KEY_L = 0x4C, - - /// - /// M key - /// - KEY_M = 0x4D, - - /// - /// N key - /// - KEY_N = 0x4E, - - /// - /// O key - /// - KEY_O = 0x4F, - - /// - /// P key - /// - KEY_P = 0x50, - - /// - /// Q key - /// - KEY_Q = 0x51, - - /// - /// R key - /// - KEY_R = 0x52, - - /// - /// S key - /// - KEY_S = 0x53, - - /// - /// T key - /// - KEY_T = 0x54, - - /// - /// U key - /// - KEY_U = 0x55, - - /// - /// V key - /// - KEY_V = 0x56, - - /// - /// W key - /// - KEY_W = 0x57, - - /// - /// X key - /// - KEY_X = 0x58, - - /// - /// Y key - /// - KEY_Y = 0x59, - - /// - /// Z key - /// - KEY_Z = 0x5A, - - /// - /// Left Windows key (Microsoft Natural keyboard) - /// - LWIN = 0x5B, - - /// - /// Right Windows key (Natural keyboard) - /// - RWIN = 0x5C, - - /// - /// Applications key (Natural keyboard) - /// - APPS = 0x5D, - - /// - /// Computer Sleep key - /// - SLEEP = 0x5F, - - /// - /// Numeric keypad 0 key - /// - NUMPAD0 = 0x60, - - /// - /// Numeric keypad 1 key - /// - NUMPAD1 = 0x61, - - /// - /// Numeric keypad 2 key - /// - NUMPAD2 = 0x62, - - /// - /// Numeric keypad 3 key - /// - NUMPAD3 = 0x63, - - /// - /// Numeric keypad 4 key - /// - NUMPAD4 = 0x64, - - /// - /// Numeric keypad 5 key - /// - NUMPAD5 = 0x65, - - /// - /// Numeric keypad 6 key - /// - NUMPAD6 = 0x66, - - /// - /// Numeric keypad 7 key - /// - NUMPAD7 = 0x67, - - /// - /// Numeric keypad 8 key - /// - NUMPAD8 = 0x68, - - /// - /// Numeric keypad 9 key - /// - NUMPAD9 = 0x69, - - /// - /// Multiply key - /// - MULTIPLY = 0x6A, - - /// - /// Add key - /// - ADD = 0x6B, - - /// - /// Separator key - /// - SEPARATOR = 0x6C, - - /// - /// Subtract key - /// - SUBTRACT = 0x6D, - - /// - /// Decimal key - /// - DECIMAL = 0x6E, - - /// - /// Divide key - /// - DIVIDE = 0x6F, - - /// - /// F1 key - /// - F1 = 0x70, - - /// - /// F2 key - /// - F2 = 0x71, - - /// - /// F3 key - /// - F3 = 0x72, - - /// - /// F4 key - /// - F4 = 0x73, - - /// - /// F5 key - /// - F5 = 0x74, - - /// - /// F6 key - /// - F6 = 0x75, - - /// - /// F7 key - /// - F7 = 0x76, - - /// - /// F8 key - /// - F8 = 0x77, - - /// - /// F9 key - /// - F9 = 0x78, - - /// - /// F10 key - /// - F10 = 0x79, - - /// - /// F11 key - /// - F11 = 0x7A, - - /// - /// F12 key - /// - F12 = 0x7B, - - /// - /// F13 key - /// - F13 = 0x7C, - - /// - /// F14 key - /// - F14 = 0x7D, - - /// - /// F15 key - /// - F15 = 0x7E, - - /// - /// F16 key - /// - F16 = 0x7F, - - /// - /// F17 key - /// - F17 = 0x80, - - /// - /// F18 key - /// - F18 = 0x81, - - /// - /// F19 key - /// - F19 = 0x82, - - /// - /// F20 key - /// - F20 = 0x83, - - /// - /// F21 key - /// - F21 = 0x84, - - /// - /// F22 key, (PPC only) Key used to lock device. - /// - F22 = 0x85, - - /// - /// F23 key - /// - F23 = 0x86, - - /// - /// F24 key - /// - F24 = 0x87, - - /// - /// NUM LOCK key - /// - NUMLOCK = 0x90, - - /// - /// SCROLL LOCK key - /// - SCROLL = 0x91, - - /// - /// Left SHIFT key - /// - LSHIFT = 0xA0, - - /// - /// Right SHIFT key - /// - RSHIFT = 0xA1, - - /// - /// Left CONTROL key - /// - LCONTROL = 0xA2, - - /// - /// Right CONTROL key - /// - RCONTROL = 0xA3, - - /// - /// Left MENU key - /// - LMENU = 0xA4, - - /// - /// Right MENU key - /// - RMENU = 0xA5, - - /// - /// Windows 2000/XP: Browser Back key - /// - BROWSER_BACK = 0xA6, - - /// - /// Windows 2000/XP: Browser Forward key - /// - BROWSER_FORWARD = 0xA7, - - /// - /// Windows 2000/XP: Browser Refresh key - /// - BROWSER_REFRESH = 0xA8, - - /// - /// Windows 2000/XP: Browser Stop key - /// - BROWSER_STOP = 0xA9, - - /// - /// Windows 2000/XP: Browser Search key - /// - BROWSER_SEARCH = 0xAA, - - /// - /// Windows 2000/XP: Browser Favorites key - /// - BROWSER_FAVORITES = 0xAB, - - /// - /// Windows 2000/XP: Browser Start and Home key - /// - BROWSER_HOME = 0xAC, - - /// - /// Windows 2000/XP: Volume Mute key - /// - VOLUME_MUTE = 0xAD, - - /// - /// Windows 2000/XP: Volume Down key - /// - VOLUME_DOWN = 0xAE, - - /// - /// Windows 2000/XP: Volume Up key - /// - VOLUME_UP = 0xAF, - - /// - /// Windows 2000/XP: Next Track key - /// - MEDIA_NEXT_TRACK = 0xB0, - - /// - /// Windows 2000/XP: Previous Track key - /// - MEDIA_PREV_TRACK = 0xB1, - - /// - /// Windows 2000/XP: Stop Media key - /// - MEDIA_STOP = 0xB2, - - /// - /// Windows 2000/XP: Play/Pause Media key - /// - MEDIA_PLAY_PAUSE = 0xB3, - - /// - /// Windows 2000/XP: Start Mail key - /// - LAUNCH_MAIL = 0xB4, - - /// - /// Windows 2000/XP: Select Media key - /// - LAUNCH_MEDIA_SELECT = 0xB5, - - /// - /// Windows 2000/XP: Start Application 1 key - /// - LAUNCH_APP1 = 0xB6, - - /// - /// Windows 2000/XP: Start Application 2 key - /// - LAUNCH_APP2 = 0xB7, - - /// - /// Used for miscellaneous characters; it can vary by keyboard. - /// - OEM_1 = 0xBA, - - /// - /// Windows 2000/XP: For any country/region, the '+' key - /// - OEM_PLUS = 0xBB, - - /// - /// Windows 2000/XP: For any country/region, the ',' key - /// - OEM_COMMA = 0xBC, - - /// - /// Windows 2000/XP: For any country/region, the '-' key - /// - OEM_MINUS = 0xBD, - - /// - /// Windows 2000/XP: For any country/region, the '.' key - /// - OEM_PERIOD = 0xBE, - - /// - /// Used for miscellaneous characters; it can vary by keyboard. - /// - OEM_2 = 0xBF, - - /// - /// Used for miscellaneous characters; it can vary by keyboard. - /// - OEM_3 = 0xC0, - - /// - /// Used for miscellaneous characters; it can vary by keyboard. - /// - OEM_4 = 0xDB, - - /// - /// Used for miscellaneous characters; it can vary by keyboard. - /// - OEM_5 = 0xDC, - - /// - /// Used for miscellaneous characters; it can vary by keyboard. - /// - OEM_6 = 0xDD, - - /// - /// Used for miscellaneous characters; it can vary by keyboard. - /// - OEM_7 = 0xDE, - - /// - /// Used for miscellaneous characters; it can vary by keyboard. - /// - OEM_8 = 0xDF, - - /// - /// Windows 2000/XP: Either the angle bracket key or the backslash key on the RT 102-key keyboard - /// - OEM_102 = 0xE2, - - /// - /// Windows 95/98/Me, Windows NT 4.0, Windows 2000/XP: IME PROCESS key - /// - PROCESSKEY = 0xE5, - - /// - /// Windows 2000/XP: Used to pass Unicode characters as if they were keystrokes. - /// The VK_PACKET key is the low word of a 32-bit Virtual Key value used for non-keyboard input methods. For more - /// information, - /// see Remark in KEYBDINPUT, SendInput, WM_KEYDOWN, and WM_KEYUP - /// - PACKET = 0xE7, - - /// - /// Attn key - /// - ATTN = 0xF6, - - /// - /// CrSel key - /// - CRSEL = 0xF7, - - /// - /// ExSel key - /// - EXSEL = 0xF8, - - /// - /// Erase EOF key - /// - EREOF = 0xF9, - - /// - /// Play key - /// - PLAY = 0xFA, - - /// - /// Zoom key - /// - ZOOM = 0xFB, - - /// - /// Reserved - /// - NONAME = 0xFC, - - /// - /// PA1 key - /// - PA1 = 0xFD, - - /// - /// Clear key - /// - OEM_CLEAR = 0xFE - } - - /// - /// These are the hardware keyboard codes - /// - public enum ScanCodeShort : ushort - { - ESCAPE = 0x01, - ESC = ESCAPE, - KEY_1 = 0x02, - KEY_2 = 0x03, - KEY_3 = 0x04, - KEY_4 = 0x05, - KEY_5 = 0x06, - KEY_6 = 0x07, - KEY_7 = 0x08, - KEY_8 = 0x09, - KEY_9 = 0x0A, - KEY_0 = 0x0B, - OEM_MINUS = 0x0C, - OEM_PLUS = 0x0D, - BACK = 0x0E, - TAB = 0x0F, - KEY_Q = 0x10, - KEY_W = 0x11, - KEY_E = 0x12, - KEY_R = 0x13, - KEY_T = 0x14, - KEY_Y = 0x15, - KEY_U = 0x16, - KEY_I = 0x17, - KEY_O = 0x18, - KEY_P = 0x19, - OPENBRACKET = 0x1A, - CLOSEBRACKET = 0x1B, - RETURN = 0x1C, - ENTER = RETURN, - CONTROL = 0x1D, - KEY_A = 0x1E, - KEY_S = 0x1F, - KEY_D = 0x20, - KEY_F = 0x21, - KEY_G = 0x22, - KEY_H = 0x23, - KEY_J = 0x24, - KEY_K = 0x25, - KEY_L = 0x26, - SEMICOLON = 0x27, - QUOTE = 0x28, - TILDE = 0x29, - SHIFT = 0x2A, - PIPE = 0x2B, - KEY_Z = 0x2C, - KEY_X = 0x2D, - KEY_C = 0x2E, - KEY_V = 0x2F, - KEY_B = 0x30, - KEY_N = 0x31, - KEY_M = 0x32, - COMMA = 0x33, - PERIOD = 0x34, - DIVIDE = 0x35, - RSHIFT = 0x36, - MULTIPLY = 0x37, - ALT = 0x38, - SPACE = 0x39, - CAPSLOCK = 0x3A, - F1 = 0x3B, - F2 = 0x3C, - F3 = 0x3D, - F4 = 0x3E, - F5 = 0x3F, - F6 = 0x40, - F7 = 0x41, - F8 = 0x42, - F9 = 0x43, - F10 = 0x44, - NUMLOCK = 0x45, - PAUSE = 0x46, - NUMPAD7 = 0x47, - NUMPAD8 = 0x48, - NUMPAD9 = 0x49, - SUBTRACT = 0x4A, - NUMPAD4 = 0x4B, - NUMPAD5 = 0x4C, - NUMPAD6 = 0x4D, - ADD = 0x4E, - NUMPAD1 = 0x4F, - NUMPAD2 = 0x50, - NUMPAD3 = 0x51, - NUMPAD0 = 0x52, - DELETE = 0x53, - SNAPSHOT = 0x54, - OEM_102 = 0x56, - F11 = 0x57, - F12 = 0x58, - LWIN = 0x5B, - RWIN = 0x5C, - WINMENU = 0x5D, - POWER = 0x5E, - SLEEP = 0x5F, - ZOOM = 0x62, - HELP = 0x63, - F13 = 0x64, - F14 = 0x65, - F15 = 0x66, - F16 = 0x67, - F17 = 0x68, - F18 = 0x69, - F19 = 0x6A, - F20 = 0x6B, - F21 = 0x6C, - F22 = 0x6D, - F23 = 0x6E, - F24 = 0x76 - } - - [Flags] - public enum KeyEventFlags : uint - { - KEYEVENTF_KEYDOWN = 0x0000, - KEYEVENTF_EXTENDEDKEY = 0x0001, - KEYEVENTF_KEYUP = 0x0002, - KEYEVENTF_UNICODE = 0x0004, - KEYEVENTF_SCANCODE = 0x0008 - } - - [Flags] - public enum SendMessageTimeoutFlags : uint - { - SMTO_NORMAL = 0x0, - SMTO_BLOCK = 0x1, - SMTO_ABORTIFHUNG = 0x2, - SMTO_NOTIMEOUTIFNOTHUNG = 0x8, - SMTO_ERRORONEXIT = 0x20 - } - - [Flags] - public enum AccessibilityState : uint - { - STATE_SYSTEM_UNAVAILABLE = 0x00000001, - STATE_SYSTEM_SELECTED = 0x00000002, - STATE_SYSTEM_FOCUSED = 0x00000004, - STATE_SYSTEM_PRESSED = 0x00000008, - STATE_SYSTEM_CHECKED = 0x00000010, - STATE_SYSTEM_MIXED = 0x00000020, - STATE_SYSTEM_READONLY = 0x00000040, - STATE_SYSTEM_HOTTRACKED = 0x00000080, - STATE_SYSTEM_DEFAULT = 0x00000100, - STATE_SYSTEM_EXPANDED = 0x00000200, - STATE_SYSTEM_COLLAPSED = 0x00000400, - STATE_SYSTEM_BUSY = 0x00000800, - STATE_SYSTEM_FLOATING = 0x00001000, - STATE_SYSTEM_MARQUEED = 0x00002000, - STATE_SYSTEM_ANIMATED = 0x00004000, - STATE_SYSTEM_INVISIBLE = 0x00008000, - STATE_SYSTEM_OFFSCREEN = 0x00010000, - STATE_SYSTEM_SIZEABLE = 0x00020000, - STATE_SYSTEM_MOVEABLE = 0x00040000, - STATE_SYSTEM_SELFVOICING = 0x00080000, - STATE_SYSTEM_FOCUSABLE = 0x00100000, - STATE_SYSTEM_SELECTABLE = 0x00200000, - STATE_SYSTEM_LINKED = 0x00400000, - STATE_SYSTEM_TRAVERSED = 0x00800000, - STATE_SYSTEM_MULTISELECTABLE = 0x01000000, - STATE_SYSTEM_EXTSELECTABLE = 0x02000000, - STATE_SYSTEM_ALERT_LOW = 0x04000000, - STATE_SYSTEM_ALERT_MEDIUM = 0x08000000, - STATE_SYSTEM_ALERT_HIGH = 0x10000000, - STATE_SYSTEM_VALID = 0x1FFFFFFF - } - - public enum AccessibilityRole : uint - { - ROLE_SYSTEM_TITLEBAR = 0x00000001, - ROLE_SYSTEM_MENUBAR = 0x00000002, - ROLE_SYSTEM_SCROLLBAR = 0x00000003, - ROLE_SYSTEM_GRIP = 0x00000004, - ROLE_SYSTEM_SOUND = 0x00000005, - ROLE_SYSTEM_CURSOR = 0x00000006, - ROLE_SYSTEM_CARET = 0x00000007, - ROLE_SYSTEM_ALERT = 0x00000008, - ROLE_SYSTEM_WINDOW = 0x00000009, - ROLE_SYSTEM_CLIENT = 0x0000000A, - ROLE_SYSTEM_MENUPOPUP = 0x0000000B, - ROLE_SYSTEM_MENUITEM = 0x0000000C, - ROLE_SYSTEM_TOOLTIP = 0x0000000D, - ROLE_SYSTEM_APPLICATION = 0x0000000E, - ROLE_SYSTEM_DOCUMENT = 0x0000000F, - ROLE_SYSTEM_PANE = 0x00000010, - ROLE_SYSTEM_CHART = 0x00000011, - ROLE_SYSTEM_DIALOG = 0x00000012, - ROLE_SYSTEM_BORDER = 0x00000013, - ROLE_SYSTEM_GROUPING = 0x00000014, - ROLE_SYSTEM_SEPARATOR = 0x00000015, - ROLE_SYSTEM_TOOLBAR = 0x00000016, - ROLE_SYSTEM_STATUSBAR = 0x00000017, - ROLE_SYSTEM_TABLE = 0x00000018, - ROLE_SYSTEM_COLUMNHEADER = 0x00000019, - ROLE_SYSTEM_ROWHEADER = 0x0000001A, - ROLE_SYSTEM_COLUMN = 0x0000001B, - ROLE_SYSTEM_ROW = 0x0000001C, - ROLE_SYSTEM_CELL = 0x0000001D, - ROLE_SYSTEM_LINK = 0x0000001E, - ROLE_SYSTEM_HELPBALLOON = 0x0000001F, - ROLE_SYSTEM_CHARACTER = 0x00000020, - ROLE_SYSTEM_LIST = 0x00000021, - ROLE_SYSTEM_LISTITEM = 0x00000022, - ROLE_SYSTEM_OUTLINE = 0x00000023, - ROLE_SYSTEM_OUTLINEITEM = 0x00000024, - ROLE_SYSTEM_PAGETAB = 0x00000025, - ROLE_SYSTEM_PROPERTYPAGE = 0x00000026, - ROLE_SYSTEM_INDICATOR = 0x00000027, - ROLE_SYSTEM_GRAPHIC = 0x00000028, - ROLE_SYSTEM_STATICTEXT = 0x00000029, - ROLE_SYSTEM_TEXT = 0x0000002A, - ROLE_SYSTEM_PUSHBUTTON = 0x0000002B, - ROLE_SYSTEM_CHECKBUTTON = 0x0000002C, - ROLE_SYSTEM_RADIOBUTTON = 0x0000002D, - ROLE_SYSTEM_COMBOBOX = 0x0000002E, - ROLE_SYSTEM_DROPLIST = 0x0000002F, - ROLE_SYSTEM_PROGRESSBAR = 0x00000030, - ROLE_SYSTEM_DIAL = 0x00000031, - ROLE_SYSTEM_HOTKEYFIELD = 0x00000032, - ROLE_SYSTEM_SLIDER = 0x00000033, - ROLE_SYSTEM_SPINBUTTON = 0x00000034, - ROLE_SYSTEM_DIAGRAM = 0x00000035, - ROLE_SYSTEM_ANIMATION = 0x00000036, - ROLE_SYSTEM_EQUATION = 0x00000037, - ROLE_SYSTEM_BUTTONDROPDOWN = 0x00000038, - ROLE_SYSTEM_BUTTONMENU = 0x00000039, - ROLE_SYSTEM_BUTTONDROPDOWNGRID = 0x0000003A, - ROLE_SYSTEM_WHITESPACE = 0x0000003B, - ROLE_SYSTEM_PAGETABLIST = 0x0000003C, - ROLE_SYSTEM_CLOCK = 0x0000003D - } - - public enum CursorState - { - /// - /// The cursor is hidden. - /// - CURSOR_HIDING = 0x00000000, - - /// - /// The cursor is showing. - /// - CURSOR_SHOWING = 0x00000001, - - /// - /// Windows 8: The cursor is suppressed. This flag indicates that the system is not drawing - /// the cursor because the user is providing input through touch or pen instead of the mouse. - /// - CURSOR_SUPPRESSED = 0x00000002 - } - - public enum StretchMode - { - STRETCH_ANDSCANS = 1, - STRETCH_ORSCANS = 2, - STRETCH_DELETESCANS = 3, - STRETCH_HALFTONE = 4, - } - - /// - /// Specifies a raster-operation code. These codes define how the color data for the - /// source rectangle is to be combined with the color data for the destination - /// rectangle to achieve the final color. - /// - public enum TernaryRasterOperations : uint - { - /// dest = source - SRCCOPY = 0x00CC0020, - /// dest = source OR dest - SRCPAINT = 0x00EE0086, - /// dest = source AND dest - SRCAND = 0x008800C6, - /// dest = source XOR dest - SRCINVERT = 0x00660046, - /// dest = source AND (NOT dest) - SRCERASE = 0x00440328, - /// dest = (NOT source) - NOTSRCCOPY = 0x00330008, - /// dest = (NOT src) AND (NOT dest) - NOTSRCERASE = 0x001100A6, - /// dest = (source AND pattern) - MERGECOPY = 0x00C000CA, - /// dest = (NOT source) OR dest - MERGEPAINT = 0x00BB0226, - /// dest = pattern - PATCOPY = 0x00F00021, - /// dest = DPSnoo - PATPAINT = 0x00FB0A09, - /// dest = pattern XOR dest - PATINVERT = 0x005A0049, - /// dest = (NOT dest) - DSTINVERT = 0x00550009, - /// dest = BLACK - BLACKNESS = 0x00000042, - /// dest = WHITE - WHITENESS = 0x00FF0062, - /// - /// Capture window as seen on screen. This includes layered windows - /// such as WPF windows with AllowsTransparency="true" - /// - CAPTUREBLT = 0x40000000 - } - - internal class Win32Constants - { - public static IntPtr TRUE = new IntPtr(1); - public static IntPtr FALSE = new IntPtr(0); - } -} -#pragma warning restore +using System; + +// ReSharper disable InconsistentNaming +#pragma warning disable +namespace FlaUI.Core.WindowsAPI +{ + public static class CommonHresultValues + { + public const long S_OK = 0x00000000; // Operation successful + public const long E_ABORT = 0x80004004; // Operation aborted + public const long E_ACCESSDENIED = 0x80070005; // General access denied error + public const long E_FAIL = 0x80004005; // Unspecified failure + public const long E_HANDLE = 0x80070006; // Handle that is not valid + public const long E_INVALIDARG = 0x80070057; // One or more arguments are not valid + public const long E_NOINTERFACE = 0x80004002; // No such interface supported + public const long E_NOTIMPL = 0x80004001; // Not implemented + public const long E_OUTOFMEMORY = 0x8007000E; // Failed to allocate necessary memory + public const long E_POINTER = 0x80004003; // Pointer that is not valid + public const long E_UNEXPECTED = 0x8000FFFF; // Unexpected failure + } + + public static class WindowsMessages + { + public const uint WM_ACTIVATE = 0x0006; + public const uint WM_ACTIVATEAPP = 0x001C; + public const uint WM_AFXFIRST = 0x0360; + public const uint WM_AFXLAST = 0x037F; + public const uint WM_APP = 0x8000; + public const uint WM_APPCOMMAND = 0x0319; + public const uint WM_ASKCBFORMATNAME = 0x030C; + public const uint WM_CANCELJOURNAL = 0x004B; + public const uint WM_CANCELMODE = 0x001F; + public const uint WM_CAPTURECHANGED = 0x0215; + public const uint WM_CHANGECBCHAIN = 0x030D; + public const uint WM_CHANGEUISTATE = 0x0127; + public const uint WM_CHAR = 0x0102; + public const uint WM_CHARTOITEM = 0x002F; + public const uint WM_CHILDACTIVATE = 0x0022; + public const uint WM_CLEAR = 0x0303; + public const uint WM_CLOSE = 0x0010; + public const uint WM_COMMAND = 0x0111; + public const uint WM_COMMNOTIFY = 0x0044; + public const uint WM_COMPACTING = 0x0041; + public const uint WM_COMPAREITEM = 0x0039; + public const uint WM_CONTEXTMENU = 0x007B; + public const uint WM_COPY = 0x0301; + public const uint WM_COPYDATA = 0x004A; + public const uint WM_CREATE = 0x0001; + public const uint WM_CTLCOLORBTN = 0x0135; + public const uint WM_CTLCOLORDLG = 0x0136; + public const uint WM_CTLCOLOREDIT = 0x0133; + public const uint WM_CTLCOLORLISTBOX = 0x0134; + public const uint WM_CTLCOLORMSGBOX = 0x0132; + public const uint WM_CTLCOLORSCROLLBAR = 0x0137; + public const uint WM_CTLCOLORSTATIC = 0x0138; + public const uint WM_CUT = 0x0300; + public const uint WM_DEADCHAR = 0x0103; + public const uint WM_DELETEITEM = 0x002D; + public const uint WM_DESTROY = 0x0002; + public const uint WM_DESTROYCLIPBOARD = 0x0307; + public const uint WM_DEVICECHANGE = 0x0219; + public const uint WM_DEVMODECHANGE = 0x001B; + public const uint WM_DISPLAYCHANGE = 0x007E; + public const uint WM_DRAWCLIPBOARD = 0x0308; + public const uint WM_DRAWITEM = 0x002B; + public const uint WM_DROPFILES = 0x0233; + public const uint WM_ENABLE = 0x000A; + public const uint WM_ENDSESSION = 0x0016; + public const uint WM_ENTERIDLE = 0x0121; + public const uint WM_ENTERMENULOOP = 0x0211; + public const uint WM_ENTERSIZEMOVE = 0x0231; + public const uint WM_ERASEBKGND = 0x0014; + public const uint WM_EXITMENULOOP = 0x0212; + public const uint WM_EXITSIZEMOVE = 0x0232; + public const uint WM_FONTCHANGE = 0x001D; + public const uint WM_GETDLGCODE = 0x0087; + public const uint WM_GETFONT = 0x0031; + public const uint WM_GETHOTKEY = 0x0033; + public const uint WM_GETICON = 0x007F; + public const uint WM_GETMINMAXINFO = 0x0024; + public const uint WM_GETOBJECT = 0x003D; + public const uint WM_GETTEXT = 0x000D; + public const uint WM_GETTEXTLENGTH = 0x000E; + public const uint WM_HANDHELDFIRST = 0x0358; + public const uint WM_HANDHELDLAST = 0x035F; + public const uint WM_HELP = 0x0053; + public const uint WM_HOTKEY = 0x0312; + public const uint WM_HSCROLL = 0x0114; + public const uint WM_HSCROLLCLIPBOARD = 0x030E; + public const uint WM_ICONERASEBKGND = 0x0027; + public const uint WM_IME_CHAR = 0x0286; + public const uint WM_IME_COMPOSITION = 0x010F; + public const uint WM_IME_COMPOSITIONFULL = 0x0284; + public const uint WM_IME_CONTROL = 0x0283; + public const uint WM_IME_ENDCOMPOSITION = 0x010E; + public const uint WM_IME_KEYDOWN = 0x0290; + public const uint WM_IME_KEYLAST = 0x010F; + public const uint WM_IME_KEYUP = 0x0291; + public const uint WM_IME_NOTIFY = 0x0282; + public const uint WM_IME_REQUEST = 0x0288; + public const uint WM_IME_SELECT = 0x0285; + public const uint WM_IME_SETCONTEXT = 0x0281; + public const uint WM_IME_STARTCOMPOSITION = 0x010D; + public const uint WM_INITDIALOG = 0x0110; + public const uint WM_INITMENU = 0x0116; + public const uint WM_INITMENUPOPUP = 0x0117; + public const uint WM_INPUT = 0x00FF; + public const uint WM_INPUTLANGCHANGE = 0x0051; + public const uint WM_INPUTLANGCHANGEREQUEST = 0x0050; + public const uint WM_KEYDOWN = 0x0100; + public const uint WM_KEYFIRST = 0x0100; + public const uint WM_KEYLAST = 0x0109; + public const uint WM_KEYUP = 0x0101; + public const uint WM_KILLFOCUS = 0x0008; + public const uint WM_LBUTTONDBLCLK = 0x0203; + public const uint WM_LBUTTONDOWN = 0x0201; + public const uint WM_LBUTTONUP = 0x0202; + public const uint WM_MBUTTONDBLCLK = 0x0209; + public const uint WM_MBUTTONDOWN = 0x0207; + public const uint WM_MBUTTONUP = 0x0208; + public const uint WM_MDIACTIVATE = 0x0222; + public const uint WM_MDICASCADE = 0x0227; + public const uint WM_MDICREATE = 0x0220; + public const uint WM_MDIDESTROY = 0x0221; + public const uint WM_MDIGETACTIVE = 0x0229; + public const uint WM_MDIICONARRANGE = 0x0228; + public const uint WM_MDIMAXIMIZE = 0x0225; + public const uint WM_MDINEXT = 0x0224; + public const uint WM_MDIREFRESHMENU = 0x0234; + public const uint WM_MDIRESTORE = 0x0223; + public const uint WM_MDISETMENU = 0x0230; + public const uint WM_MDITILE = 0x0226; + public const uint WM_MEASUREITEM = 0x002C; + public const uint WM_MENUCHAR = 0x0120; + public const uint WM_MENUCOMMAND = 0x0126; + public const uint WM_MENUDRAG = 0x0123; + public const uint WM_MENUGETOBJECT = 0x0124; + public const uint WM_MENURBUTTONUP = 0x0122; + public const uint WM_MENUSELECT = 0x011F; + public const uint WM_MOUSEACTIVATE = 0x0021; + public const uint WM_MOUSEFIRST = 0x0200; + public const uint WM_MOUSEHOVER = 0x02A1; + public const uint WM_MOUSELAST = 0x020D; // Win95: 0x0209, WinNT4,98: 0x020A + public const uint WM_MOUSELEAVE = 0x02A3; + public const uint WM_MOUSEMOVE = 0x0200; + public const uint WM_MOUSEWHEEL = 0x020A; + public const uint WM_MOVE = 0x0003; + public const uint WM_MOVING = 0x0216; + public const uint WM_NCACTIVATE = 0x0086; + public const uint WM_NCCALCSIZE = 0x0083; + public const uint WM_NCCREATE = 0x0081; + public const uint WM_NCDESTROY = 0x0082; + public const uint WM_NCHITTEST = 0x0084; + public const uint WM_NCLBUTTONDBLCLK = 0x00A3; + public const uint WM_NCLBUTTONDOWN = 0x00A1; + public const uint WM_NCLBUTTONUP = 0x00A2; + public const uint WM_NCMBUTTONDBLCLK = 0x00A9; + public const uint WM_NCMBUTTONDOWN = 0x00A7; + public const uint WM_NCMBUTTONUP = 0x00A8; + public const uint WM_NCMOUSEHOVER = 0x02A0; + public const uint WM_NCMOUSELEAVE = 0x02A2; + public const uint WM_NCMOUSEMOVE = 0x00A0; + public const uint WM_NCPAINT = 0x0085; + public const uint WM_NCRBUTTONDBLCLK = 0x00A6; + public const uint WM_NCRBUTTONDOWN = 0x00A4; + public const uint WM_NCRBUTTONUP = 0x00A5; + public const uint WM_NCXBUTTONDBLCLK = 0x00AD; + public const uint WM_NCXBUTTONDOWN = 0x00AB; + public const uint WM_NCXBUTTONUP = 0x00AC; + public const uint WM_NEXTDLGCTL = 0x0028; + public const uint WM_NEXTMENU = 0x0213; + public const uint WM_NOTIFY = 0x004E; + public const uint WM_NOTIFYFORMAT = 0x0055; + public const uint WM_NULL = 0x0000; + public const uint WM_PAINT = 0x000F; + public const uint WM_PAINTCLIPBOARD = 0x0309; + public const uint WM_PAINTICON = 0x0026; + public const uint WM_PALETTECHANGED = 0x0311; + public const uint WM_PALETTEISCHANGING = 0x0310; + public const uint WM_PARENTNOTIFY = 0x0210; + public const uint WM_PASTE = 0x0302; + public const uint WM_PENWINFIRST = 0x0380; + public const uint WM_PENWINLAST = 0x038F; + public const uint WM_POWER = 0x0048; + public const uint WM_POWERBROADCAST = 0x0218; + public const uint WM_PRINT = 0x0317; + public const uint WM_PRINTCLIENT = 0x0318; + public const uint WM_QUERYDRAGICON = 0x0037; + public const uint WM_QUERYENDSESSION = 0x0011; + public const uint WM_QUERYNEWPALETTE = 0x030F; + public const uint WM_QUERYOPEN = 0x0013; + public const uint WM_QUERYUISTATE = 0x0129; + public const uint WM_QUEUESYNC = 0x0023; + public const uint WM_QUIT = 0x0012; + public const uint WM_RBUTTONDBLCLK = 0x0206; + public const uint WM_RBUTTONDOWN = 0x0204; + public const uint WM_RBUTTONUP = 0x0205; + public const uint WM_RENDERALLFORMATS = 0x0306; + public const uint WM_RENDERFORMAT = 0x0305; + public const uint WM_SETCURSOR = 0x0020; + public const uint WM_SETFOCUS = 0x0007; + public const uint WM_SETFONT = 0x0030; + public const uint WM_SETHOTKEY = 0x0032; + public const uint WM_SETICON = 0x0080; + public const uint WM_SETREDRAW = 0x000B; + public const uint WM_SETTEXT = 0x000C; + public const uint WM_SETTINGCHANGE = 0x001A; + public const uint WM_SHOWWINDOW = 0x0018; + public const uint WM_SIZE = 0x0005; + public const uint WM_SIZECLIPBOARD = 0x030B; + public const uint WM_SIZING = 0x0214; + public const uint WM_SPOOLERSTATUS = 0x002A; + public const uint WM_STYLECHANGED = 0x007D; + public const uint WM_STYLECHANGING = 0x007C; + public const uint WM_SYNCPAINT = 0x0088; + public const uint WM_SYSCHAR = 0x0106; + public const uint WM_SYSCOLORCHANGE = 0x0015; + public const uint WM_SYSCOMMAND = 0x0112; + public const uint WM_SYSDEADCHAR = 0x0107; + public const uint WM_SYSKEYDOWN = 0x0104; + public const uint WM_SYSKEYUP = 0x0105; + public const uint WM_TABLET_FIRST = 0x02C0; + public const uint WM_TABLET_LAST = 0x02DF; + public const uint WM_TCARD = 0x0052; + public const uint WM_THEMECHANGED = 0x031A; + public const uint WM_TIMECHANGE = 0x001E; + public const uint WM_TIMER = 0x0113; + public const uint WM_UNDO = 0x0304; + public const uint WM_UNICHAR = 0x0109; + public const uint WM_UNINITMENUPOPUP = 0x0125; + public const uint WM_UPDATEUISTATE = 0x0128; + public const uint WM_USER = 0x0400; + public const uint WM_USERCHANGED = 0x0054; + public const uint WM_VKEYTOITEM = 0x002E; + public const uint WM_VSCROLL = 0x0115; + public const uint WM_VSCROLLCLIPBOARD = 0x030A; + public const uint WM_WINDOWPOSCHANGED = 0x0047; + public const uint WM_WINDOWPOSCHANGING = 0x0046; + public const uint WM_WININICHANGE = 0x001A; + public const uint WM_WTSSESSION_CHANGE = 0x02B1; + public const uint WM_XBUTTONDBLCLK = 0x020D; + public const uint WM_XBUTTONDOWN = 0x020B; + public const uint WM_XBUTTONUP = 0x020C; + } + + public static class WindowLongParam + { + public const int GWL_WNDPROC = -4; + public const int GWL_HINSTANCE = -6; + public const int GWL_HWNDPARENT = -8; + public const int GWL_STYLE = -16; + public const int GWL_EXSTYLE = -20; + public const int GWL_USERDATA = -21; + public const int GWL_ID = -12; + } + + public static class WindowStyles + { + public const uint WS_OVERLAPPED = 0x00000000; + public const uint WS_POPUP = 0x80000000; + public const uint WS_CHILD = 0x40000000; + public const uint WS_MINIMIZE = 0x20000000; + public const uint WS_VISIBLE = 0x10000000; + public const uint WS_DISABLED = 0x08000000; + public const uint WS_CLIPSIBLINGS = 0x04000000; + public const uint WS_CLIPCHILDREN = 0x02000000; + public const uint WS_MAXIMIZE = 0x01000000; + public const uint WS_CAPTION = 0x00C00000; /* WS_BORDER | WS_DLGFRAME */ + public const uint WS_BORDER = 0x00800000; + public const uint WS_DLGFRAME = 0x00400000; + public const uint WS_VSCROLL = 0x00200000; + public const uint WS_HSCROLL = 0x00100000; + public const uint WS_SYSMENU = 0x00080000; + public const uint WS_THICKFRAME = 0x00040000; + public const uint WS_GROUP = 0x00020000; + public const uint WS_TABSTOP = 0x00010000; + + public const uint WS_MINIMIZEBOX = 0x00020000; + public const uint WS_MAXIMIZEBOX = 0x00010000; + + public const uint WS_TILED = WS_OVERLAPPED; + public const uint WS_ICONIC = WS_MINIMIZE; + public const uint WS_SIZEBOX = WS_THICKFRAME; + public const uint WS_TILEDWINDOW = WS_OVERLAPPEDWINDOW; + + // Common Window Styles + public const uint WS_OVERLAPPEDWINDOW = WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX; + public const uint WS_POPUPWINDOW = WS_POPUP | WS_BORDER | WS_SYSMENU; + public const uint WS_CHILDWINDOW = WS_CHILD; + + //Extended Window Styles + public const uint WS_EX_DLGMODALFRAME = 0x00000001; + public const uint WS_EX_NOPARENTNOTIFY = 0x00000004; + public const uint WS_EX_TOPMOST = 0x00000008; + public const uint WS_EX_ACCEPTFILES = 0x00000010; + public const uint WS_EX_TRANSPARENT = 0x00000020; + + //#if(WINVER >= 0x0400) + public const uint WS_EX_MDICHILD = 0x00000040; + public const uint WS_EX_TOOLWINDOW = 0x00000080; + public const uint WS_EX_WINDOWEDGE = 0x00000100; + public const uint WS_EX_CLIENTEDGE = 0x00000200; + public const uint WS_EX_CONTEXTHELP = 0x00000400; + + public const uint WS_EX_RIGHT = 0x00001000; + public const uint WS_EX_LEFT = 0x00000000; + public const uint WS_EX_RTLREADING = 0x00002000; + public const uint WS_EX_LTRREADING = 0x00000000; + public const uint WS_EX_LEFTSCROLLBAR = 0x00004000; + public const uint WS_EX_RIGHTSCROLLBAR = 0x00000000; + + public const uint WS_EX_CONTROLPARENT = 0x00010000; + public const uint WS_EX_STATICEDGE = 0x00020000; + public const uint WS_EX_APPWINDOW = 0x00040000; + + public const uint WS_EX_OVERLAPPEDWINDOW = WS_EX_WINDOWEDGE | WS_EX_CLIENTEDGE; + public const uint WS_EX_PALETTEWINDOW = WS_EX_WINDOWEDGE | WS_EX_TOOLWINDOW | WS_EX_TOPMOST; + //#endif /* WINVER >= 0x0400 */ + + //#if(_WIN32_WINNT >= 0x0500) + public const uint WS_EX_LAYERED = 0x00080000; + //#endif /* _WIN32_WINNT >= 0x0500 */ + + //#if(WINVER >= 0x0500) + public const uint WS_EX_NOINHERITLAYOUT = 0x00100000; // Disable inheritance of mirroring by children + public const uint WS_EX_LAYOUTRTL = 0x00400000; // Right to left mirroring + //#endif /* WINVER >= 0x0500 */ + + //#if(_WIN32_WINNT >= 0x0500) + public const uint WS_EX_COMPOSITED = 0x02000000; + public const uint WS_EX_NOACTIVATE = 0x08000000; + //#endif /* _WIN32_WINNT >= 0x0500 */ + } + + public static class SetWindowPosFlags + { + public const int SWP_NOSIZE = 0x0001; + public const int SWP_NOMOVE = 0x0002; + public const int SWP_NOZORDER = 0x0004; + public const int SWP_NOREDRAW = 0x0008; + public const int SWP_NOACTIVATE = 0x0010; + public const int SWP_FRAMECHANGED = 0x0020; + public const int SWP_SHOWWINDOW = 0x0040; + public const int SWP_HIDEWINDOW = 0x0080; + public const int SWP_NOCOPYBITS = 0x0100; + public const int SWP_NOOWNERZORDER = 0x0200; + public const int SWP_DRAWFRAME = SWP_FRAMECHANGED; + public const int SWP_NOREPOSITION = SWP_NOOWNERZORDER; + public const int SWP_NOSENDCHANGING = 0x0400; + public const int SWP_DEFERERASE = 0x2000; + public const int SWP_ASYNCWINDOWPOS = 0x4000; + } + + public static class ShowWindowTypes + { + public const int SW_HIDE = 0; + public const int SW_SHOWNORMAL = 1; + public const int SW_NORMAL = 1; + public const int SW_SHOWMINIMIZED = 2; + public const int SW_SHOWMAXIMIZED = 3; + public const int SW_MAXIMIZE = 3; + public const int SW_SHOWNOACTIVATE = 4; + public const int SW_SHOW = 5; + public const int SW_MINIMIZE = 6; + public const int SW_SHOWMINNOACTIVE = 7; + public const int SW_SHOWNA = 8; + public const int SW_RESTORE = 9; + public const int SW_SHOWDEFAULT = 10; + public const int SW_FORCEMINIMIZE = 11; + public const int SW_MAX = 11; + } + + public static class LayeredWindowAttributes + { + public const uint LWA_COLORKEY = 0x1; + public const uint LWA_ALPHA = 0x2; + } + + public enum SystemMetric + { + /// + /// The flags that specify how the system arranged minimized windows. For more information, see the Remarks section in this topic. + /// + SM_ARRANGE = 56, + + /// + /// The value that specifies how the system is started: + /// 0 Normal boot + /// 1 Fail-safe boot + /// 2 Fail-safe with network boot + /// A fail-safe boot (also called SafeBoot, Safe Mode, or Clean Boot) bypasses the user startup files. + /// + SM_CLEANBOOT = 67, + + /// + /// The number of display monitors on a desktop. For more information, see the Remarks section in this topic. + /// + SM_CMONITORS = 80, + + /// + /// The number of buttons on a mouse, or zero if no mouse is installed. + /// + SM_CMOUSEBUTTONS = 43, + + /// + /// Reflects the state of the laptop or slate mode, 0 for Slate Mode and non-zero otherwise. When this system metric changes, the system sends a broadcast message via WM_SETTINGCHANGE with "ConvertibleSlateMode" in the LPARAM. Note that this system metric doesn't apply to desktop PCs. In that case, use GetAutoRotationState. + /// + SM_CONVERTIBLESLATEMODE = 0x2003, + + /// + /// The width of a window border, in pixels. This is equivalent to the SM_CXEDGE value for windows with the 3-D look. + /// + SM_CXBORDER = 5, + + /// + /// The width of a cursor, in pixels. The system cannot create cursors of other sizes. + /// + SM_CXCURSOR = 13, + + /// + /// This value is the same as SM_CXFIXEDFRAME. + /// + SM_CXDLGFRAME = 7, + + /// + /// The width of the rectangle around the location of a first click in a double-click sequence, in pixels. The second click must occur within the rectangle that is defined by SM_CXDOUBLECLK and SM_CYDOUBLECLK for the system to consider the two clicks a double-click. The two clicks must also occur within a specified time. + /// To set the width of the double-click rectangle, call SystemParametersInfo with SPI_SETDOUBLECLKWIDTH. + + /// + SM_CXDOUBLECLK = 36, + + /// + /// The number of pixels on either side of a mouse-down point that the mouse pointer can move before a drag operation begins. This allows the user to click and release the mouse button easily without unintentionally starting a drag operation. If this value is negative, it is subtracted from the left of the mouse-down point and added to the right of it. + /// + SM_CXDRAG = 68, + + /// + /// The width of a 3-D border, in pixels. This metric is the 3-D counterpart of SM_CXBORDER. + /// + SM_CXEDGE = 45, + + /// + /// The thickness of the frame around the perimeter of a window that has a caption but is not sizable, in pixels. SM_CXFIXEDFRAME is the height of the horizontal border, and SM_CYFIXEDFRAME is the width of the vertical border. + /// This value is the same as SM_CXDLGFRAME. + + /// + SM_CXFIXEDFRAME = 7, + + /// + /// The width of the left and right edges of the focus rectangle that the DrawFocusRect draws. This value is in pixels. + /// Windows 2000: This value is not supported. + + /// + SM_CXFOCUSBORDER = 83, + + /// + /// This value is the same as SM_CXSIZEFRAME. + /// + SM_CXFRAME = 32, + + /// + /// The width of the client area for a full-screen window on the primary display monitor, in pixels. To get the coordinates of the portion of the screen that is not obscured by the system taskbar or by application desktop toolbars, call the SystemParametersInfo function with the SPI_GETWORKAREA value. + /// + SM_CXFULLSCREEN = 16, + + /// + /// The width of the arrow bitmap on a horizontal scroll bar, in pixels. + /// + SM_CXHSCROLL = 21, + + /// + /// The width of the thumb box in a horizontal scroll bar, in pixels. + /// + SM_CXHTHUMB = 10, + + /// + /// The default width of an icon, in pixels. The LoadIcon function can load only icons with the dimensions that SM_CXICON and SM_CYICON specifies. + /// + SM_CXICON = 11, + + /// + /// The width of a grid cell for items in large icon view, in pixels. Each item fits into a rectangle of size SM_CXICONSPACING by SM_CYICONSPACING when arranged. This value is always greater than or equal to SM_CXICON. + /// + SM_CXICONSPACING = 38, + + /// + /// The default width, in pixels, of a maximized top-level window on the primary display monitor. + /// + SM_CXMAXIMIZED = 61, + + /// + /// The default maximum width of a window that has a caption and sizing borders, in pixels. This metric refers to the entire desktop. The user cannot drag the window frame to a size larger than these dimensions. A window can override this value by processing the WM_GETMINMAXINFO message. + /// + SM_CXMAXTRACK = 59, + + /// + /// The width of the default menu check-mark bitmap, in pixels. + /// + SM_CXMENUCHECK = 71, + + /// + /// The width of menu bar buttons, such as the child window close button that is used in the multiple document interface, in pixels. + /// + SM_CXMENUSIZE = 54, + + /// + /// The minimum width of a window, in pixels. + /// + SM_CXMIN = 28, + + /// + /// The width of a minimized window, in pixels. + /// + SM_CXMINIMIZED = 57, + + /// + /// The width of a grid cell for a minimized window, in pixels. Each minimized window fits into a rectangle this size when arranged. This value is always greater than or equal to SM_CXMINIMIZED. + /// + SM_CXMINSPACING = 47, + + /// + /// The minimum tracking width of a window, in pixels. The user cannot drag the window frame to a size smaller than these dimensions. A window can override this value by processing the WM_GETMINMAXINFO message. + /// + SM_CXMINTRACK = 34, + + /// + /// The amount of border padding for captioned windows, in pixels. + /// Windows XP/2000: This value is not supported. + + /// + SM_CXPADDEDBORDER = 92, + + /// + /// The width of the screen of the primary display monitor, in pixels. This is the same value obtained by calling GetDeviceCaps as follows: GetDeviceCaps( hdcPrimaryMonitor, HORZRES). + /// + SM_CXSCREEN = 0, + + /// + /// The width of a button in a window caption or title bar, in pixels. + /// + SM_CXSIZE = 30, + + /// + /// The thickness of the sizing border around the perimeter of a window that can be resized, in pixels. SM_CXSIZEFRAME is the width of the horizontal border, and SM_CYSIZEFRAME is the height of the vertical border. + /// This value is the same as SM_CXFRAME. + + /// + SM_CXSIZEFRAME = 32, + + /// + /// The recommended width of a small icon, in pixels. Small icons typically appear in window captions and in small icon view. + /// + SM_CXSMICON = 49, + + /// + /// The width of small caption buttons, in pixels. + /// + SM_CXSMSIZE = 52, + + /// + /// The width of the virtual screen, in pixels. The virtual screen is the bounding rectangle of all display monitors. The SM_XVIRTUALSCREEN metric is the coordinates for the left side of the virtual screen. + /// + SM_CXVIRTUALSCREEN = 78, + + /// + /// The width of a vertical scroll bar, in pixels. + /// + SM_CXVSCROLL = 2, + + /// + /// The height of a window border, in pixels. This is equivalent to the SM_CYEDGE value for windows with the 3-D look. + /// + SM_CYBORDER = 6, + + /// + /// The height of a caption area, in pixels. + /// + SM_CYCAPTION = 4, + + /// + /// The height of a cursor, in pixels. The system cannot create cursors of other sizes. + /// + SM_CYCURSOR = 14, + + /// + /// This value is the same as SM_CYFIXEDFRAME. + /// + SM_CYDLGFRAME = 8, + + /// + /// The height of the rectangle around the location of a first click in a double-click sequence, in pixels. The second click must occur within the rectangle defined by SM_CXDOUBLECLK and SM_CYDOUBLECLK for the system to consider the two clicks a double-click. The two clicks must also occur within a specified time. + /// To set the height of the double-click rectangle, call SystemParametersInfo with SPI_SETDOUBLECLKHEIGHT. + + /// + SM_CYDOUBLECLK = 37, + + /// + /// The number of pixels above and below a mouse-down point that the mouse pointer can move before a drag operation begins. This allows the user to click and release the mouse button easily without unintentionally starting a drag operation. If this value is negative, it is subtracted from above the mouse-down point and added below it. + /// + SM_CYDRAG = 69, + + /// + /// The height of a 3-D border, in pixels. This is the 3-D counterpart of SM_CYBORDER. + /// + SM_CYEDGE = 46, + + /// + /// The thickness of the frame around the perimeter of a window that has a caption but is not sizable, in pixels. SM_CXFIXEDFRAME is the height of the horizontal border, and SM_CYFIXEDFRAME is the width of the vertical border. + /// This value is the same as SM_CYDLGFRAME. + + /// + SM_CYFIXEDFRAME = 8, + + /// + /// The height of the top and bottom edges of the focus rectangle drawn by DrawFocusRect. This value is in pixels. + /// Windows 2000: This value is not supported. + + /// + SM_CYFOCUSBORDER = 84, + + /// + /// This value is the same as SM_CYSIZEFRAME. + /// + SM_CYFRAME = 33, + + /// + /// The height of the client area for a full-screen window on the primary display monitor, in pixels. To get the coordinates of the portion of the screen not obscured by the system taskbar or by application desktop toolbars, call the SystemParametersInfo function with the SPI_GETWORKAREA value. + /// + SM_CYFULLSCREEN = 17, + + /// + /// The height of a horizontal scroll bar, in pixels. + /// + SM_CYHSCROLL = 3, + + /// + /// The default height of an icon, in pixels. The LoadIcon function can load only icons with the dimensions SM_CXICON and SM_CYICON. + /// + SM_CYICON = 12, + + /// + /// The height of a grid cell for items in large icon view, in pixels. Each item fits into a rectangle of size SM_CXICONSPACING by SM_CYICONSPACING when arranged. This value is always greater than or equal to SM_CYICON. + /// + SM_CYICONSPACING = 39, + + /// + /// For double byte character set versions of the system, this is the height of the Kanji window at the bottom of the screen, in pixels. + /// + SM_CYKANJIWINDOW = 18, + + /// + /// The default height, in pixels, of a maximized top-level window on the primary display monitor. + /// + SM_CYMAXIMIZED = 62, + + /// + /// The default maximum height of a window that has a caption and sizing borders, in pixels. This metric refers to the entire desktop. The user cannot drag the window frame to a size larger than these dimensions. A window can override this value by processing the WM_GETMINMAXINFO message. + /// + SM_CYMAXTRACK = 60, + + /// + /// The height of a single-line menu bar, in pixels. + /// + SM_CYMENU = 15, + + /// + /// The height of the default menu check-mark bitmap, in pixels. + /// + SM_CYMENUCHECK = 72, + + /// + /// The height of menu bar buttons, such as the child window close button that is used in the multiple document interface, in pixels. + /// + SM_CYMENUSIZE = 55, + + /// + /// The minimum height of a window, in pixels. + /// + SM_CYMIN = 29, + + /// + /// The height of a minimized window, in pixels. + /// + SM_CYMINIMIZED = 58, + + /// + /// The height of a grid cell for a minimized window, in pixels. Each minimized window fits into a rectangle this size when arranged. This value is always greater than or equal to SM_CYMINIMIZED. + /// + SM_CYMINSPACING = 48, + + /// + /// The minimum tracking height of a window, in pixels. The user cannot drag the window frame to a size smaller than these dimensions. A window can override this value by processing the WM_GETMINMAXINFO message. + /// + SM_CYMINTRACK = 35, + + /// + /// The height of the screen of the primary display monitor, in pixels. This is the same value obtained by calling GetDeviceCaps as follows: GetDeviceCaps( hdcPrimaryMonitor, VERTRES). + /// + SM_CYSCREEN = 1, + + /// + /// The height of a button in a window caption or title bar, in pixels. + /// + SM_CYSIZE = 31, + + /// + /// The thickness of the sizing border around the perimeter of a window that can be resized, in pixels. SM_CXSIZEFRAME is the width of the horizontal border, and SM_CYSIZEFRAME is the height of the vertical border. + /// This value is the same as SM_CYFRAME. + + /// + SM_CYSIZEFRAME = 33, + + /// + /// The height of a small caption, in pixels. + /// + SM_CYSMCAPTION = 51, + + /// + /// The recommended height of a small icon, in pixels. Small icons typically appear in window captions and in small icon view. + /// + SM_CYSMICON = 50, + + /// + /// The height of small caption buttons, in pixels. + /// + SM_CYSMSIZE = 53, + + /// + /// The height of the virtual screen, in pixels. The virtual screen is the bounding rectangle of all display monitors. The SM_YVIRTUALSCREEN metric is the coordinates for the top of the virtual screen. + /// + SM_CYVIRTUALSCREEN = 79, + + /// + /// The height of the arrow bitmap on a vertical scroll bar, in pixels. + /// + SM_CYVSCROLL = 20, + + /// + /// The height of the thumb box in a vertical scroll bar, in pixels. + /// + SM_CYVTHUMB = 9, + + /// + /// Nonzero if User32.dll supports DBCS; otherwise, 0. + /// + SM_DBCSENABLED = 42, + + /// + /// Nonzero if the debug version of User.exe is installed; otherwise, 0. + /// + SM_DEBUG = 22, + + /// + /// Nonzero if the current operating system is Windows 7 or Windows Server 2008 R2 and the Tablet PC Input service is started; otherwise, 0. The return value is a bitmask that specifies the type of digitizer input supported by the device. For more information, see Remarks. + /// Windows Server 2008, Windows Vista and Windows XP/2000: This value is not supported. + /// + SM_DIGITIZER = 94, + + /// + /// Nonzero if Input Method Manager/Input Method Editor features are enabled; otherwise, 0. + /// SM_IMMENABLED indicates whether the system is ready to use a Unicode-based IME on a Unicode application. To ensure that a language-dependent IME works, check SM_DBCSENABLED and the system ANSI code page. Otherwise the ANSI-to-Unicode conversion may not be performed correctly, or some components like fonts or registry settings may not be present. + /// + SM_IMMENABLED = 82, + + /// + /// Nonzero if there are digitizers in the system; otherwise, 0. + /// SM_MAXIMUMTOUCHES returns the aggregate maximum of the maximum number of contacts supported by every digitizer in the system. If the system has only single-touch digitizers, the return value is 1. If the system has multi-touch digitizers, the return value is the number of simultaneous contacts the hardware can provide. + /// Windows Server 2008, Windows Vista and Windows XP/2000: This value is not supported. + /// + SM_MAXIMUMTOUCHES = 95, + + /// + /// Nonzero if the current operating system is the Windows XP, Media Center Edition, 0 if not. + /// + SM_MEDIACENTER = 87, + + /// + /// Nonzero if drop-down menus are right-aligned with the corresponding menu-bar item; 0 if the menus are left-aligned. + /// + SM_MENUDROPALIGNMENT = 40, + + /// + /// Nonzero if the system is enabled for Hebrew and Arabic languages, 0 if not. + /// + SM_MIDEASTENABLED = 74, + + /// + /// Nonzero if a mouse is installed; otherwise, 0. This value is rarely zero, because of support for virtual mice and because some systems detect the presence of the port instead of the presence of a mouse. + /// + SM_MOUSEPRESENT = 19, + + /// + /// Nonzero if a mouse with a horizontal scroll wheel is installed; otherwise 0. + /// + SM_MOUSEHORIZONTALWHEELPRESENT = 91, + + /// + /// Nonzero if a mouse with a vertical scroll wheel is installed; otherwise 0. + /// + SM_MOUSEWHEELPRESENT = 75, + + /// + /// The least significant bit is set if a network is present; otherwise, it is cleared. The other bits are reserved for future use. + /// + SM_NETWORK = 63, + + /// + /// Nonzero if the Microsoft Windows for Pen computing extensions are installed; zero otherwise. + /// + SM_PENWINDOWS = 41, + + /// + /// This system metric is used in a Terminal Services environment to determine if the current Terminal Server session is being remotely controlled. Its value is nonzero if the current session is remotely controlled; otherwise, 0. + /// You can use terminal services management tools such as Terminal Services Manager (tsadmin.msc) and shadow.exe to control a remote session. When a session is being remotely controlled, another user can view the contents of that session and potentially interact with it. + /// + SM_REMOTECONTROL = 0x2001, + + /// + /// This system metric is used in a Terminal Services environment. If the calling process is associated with a Terminal Services client session, the return value is nonzero. If the calling process is associated with the Terminal Services console session, the return value is 0. Windows Server 2003 and Windows XP: The console session is not necessarily the physical console. For more information, see WTSGetActiveConsoleSessionId. + /// + SM_REMOTESESSION = 0x1000, + + /// + /// Nonzero if all the display monitors have the same color format, otherwise, 0. Two displays can have the same bit depth, but different color formats. For example, the red, green, and blue pixels can be encoded with different numbers of bits, or those bits can be located in different places in a pixel color value. + /// + SM_SAMEDISPLAYFORMAT = 81, + + /// + /// This system metric should be ignored; it always returns 0. + /// + SM_SECURE = 44, + + /// + /// The build number if the system is Windows Server 2003 R2; otherwise, 0. + /// + SM_SERVERR2 = 89, + + /// + /// Nonzero if the user requires an application to present information visually in situations where it would otherwise present the information only in audible form; otherwise, 0. + /// + SM_SHOWSOUNDS = 70, + + /// + /// Nonzero if the current session is shutting down; otherwise, 0. + /// Windows 2000: This value is not supported. + /// + SM_SHUTTINGDOWN = 0x2000, + + /// + /// Nonzero if the computer has a low-end (slow) processor; otherwise, 0. + /// + SM_SLOWMACHINE = 73, + + /// + /// Nonzero if the current operating system is Windows 7 Starter Edition, Windows Vista Starter, or Windows XP Starter Edition; otherwise, 0. + /// + SM_STARTER = 88, + + /// + /// Nonzero if the meanings of the left and right mouse buttons are swapped; otherwise, 0. + /// + SM_SWAPBUTTON = 23, + + /// + /// Reflects the state of the docking mode, 0 for Undocked Mode and non-zero otherwise. When this system metric changes, the system sends a broadcast message via WM_SETTINGCHANGE with "SystemDockMode" in the LPARAM. + /// + SM_SYSTEMDOCKED = 0x2004, + + /// + /// Nonzero if the current operating system is the Windows XP Tablet PC edition or if the current operating system is Windows Vista or Windows 7 and the Tablet PC Input service is started; otherwise, 0. The SM_DIGITIZER setting indicates the type of digitizer input supported by a device running Windows 7 or Windows Server 2008 R2. For more information, see Remarks. + /// + SM_TABLETPC = 86, + + /// + /// The coordinates for the left side of the virtual screen. The virtual screen is the bounding rectangle of all display monitors. The SM_CXVIRTUALSCREEN metric is the width of the virtual screen. + /// + SM_XVIRTUALSCREEN = 76, + + /// + /// The coordinates for the top of the virtual screen. The virtual screen is the bounding rectangle of all display monitors. The SM_CYVIRTUALSCREEN metric is the height of the virtual screen. + /// + SM_YVIRTUALSCREEN = 77 + } + + public enum InputType : uint + { + INPUT_MOUSE = 0, + INPUT_KEYBOARD = 1, + INPUT_HARDWARE = 2 + } + + [Flags] + public enum MouseEventFlags : uint + { + MOUSEEVENTF_MOVE = 0x0001, + MOUSEEVENTF_LEFTDOWN = 0x0002, + MOUSEEVENTF_LEFTUP = 0x0004, + MOUSEEVENTF_RIGHTDOWN = 0x0008, + MOUSEEVENTF_RIGHTUP = 0x0010, + MOUSEEVENTF_MIDDLEDOWN = 0x0020, + MOUSEEVENTF_MIDDLEUP = 0x0040, + MOUSEEVENTF_XDOWN = 0x0080, + MOUSEEVENTF_XUP = 0x0100, + MOUSEEVENTF_WHEEL = 0x0800, + MOUSEEVENTF_HWHEEL = 0x1000, // >= Win Vista only + MOUSEEVENTF_MOVE_NOCOALESCE = 0x2000, + MOUSEEVENTF_VIRTUALDESK = 0x4000, + MOUSEEVENTF_ABSOLUTE = 0x8000 + } + + [Flags] + public enum MouseEventDataXButtons : uint + { + NOTHING = 0x00000000, + XBUTTON1 = 0x00000001, + XBUTTON2 = 0x00000002 + } + + [Flags] + public enum VkKeyScanModifiers : byte + { + NONE = 0, + SHIFT = 0x01, + CONTROL = 0x02, + ALT = 0x04, + Hankaku = 0x08, + Reserved1 = 0x10, + Reserved2 = 0x20 + } + + public enum VirtualKeyShort : ushort + { + /// + /// Left mouse button + /// + LBUTTON = 0x01, + + /// + /// Right mouse button + /// + RBUTTON = 0x02, + + /// + /// Control-break processing + /// + CANCEL = 0x03, + + /// + /// Middle mouse button (three-button mouse) + /// + MBUTTON = 0x04, + + /// + /// Windows 2000/XP: X1 mouse button + /// + XBUTTON1 = 0x05, + + /// + /// Windows 2000/XP: X2 mouse button + /// + XBUTTON2 = 0x06, + + /// + /// BACKSPACE key + /// + BACK = 0x08, + + /// + /// TAB key + /// + TAB = 0x09, + + /// + /// CLEAR key + /// + CLEAR = 0x0C, + + /// + /// ENTER key + /// + RETURN = 0x0D, + ENTER = RETURN, + + /// + /// SHIFT key + /// + SHIFT = 0x10, + + /// + /// CTRL key + /// + CONTROL = 0x11, + + /// + /// ALT key + /// + ALT = 0x12, + + /// + /// PAUSE key + /// + PAUSE = 0x13, + + /// + /// CAPS LOCK key + /// + CAPITAL = 0x14, + CAPSLOCK = CAPITAL, + + /// + /// Input Method Editor (IME) Kana mode + /// + KANA = 0x15, + + /// + /// IME Hangul mode + /// + HANGUL = 0x15, + + /// + /// IME Junja mode + /// + JUNJA = 0x17, + + /// + /// IME final mode + /// + FINAL = 0x18, + + /// + /// IME Hanja mode + /// + HANJA = 0x19, + + /// + /// IME Kanji mode + /// + KANJI = 0x19, + + /// + /// ESC key + /// + ESCAPE = 0x1B, + ESC = ESCAPE, + + /// + /// IME convert + /// + CONVERT = 0x1C, + + /// + /// IME nonconvert + /// + NONCONVERT = 0x1D, + + /// + /// IME accept + /// + ACCEPT = 0x1E, + + /// + /// IME mode change request + /// + MODECHANGE = 0x1F, + + /// + /// SPACEBAR + /// + SPACE = 0x20, + + /// + /// PAGE UP key + /// + PRIOR = 0x21, + + /// + /// PAGE DOWN key + /// + NEXT = 0x22, + + /// + /// END key + /// + END = 0x23, + + /// + /// HOME key + /// + HOME = 0x24, + + /// + /// LEFT ARROW key + /// + LEFT = 0x25, + + /// + /// UP ARROW key + /// + UP = 0x26, + + /// + /// RIGHT ARROW key + /// + RIGHT = 0x27, + + /// + /// DOWN ARROW key + /// + DOWN = 0x28, + + /// + /// SELECT key + /// + SELECT = 0x29, + + /// + /// PRINT key + /// + PRINT = 0x2A, + + /// + /// EXECUTE key + /// + EXECUTE = 0x2B, + + /// + /// PRINT SCREEN key + /// + SNAPSHOT = 0x2C, + + /// + /// INS key + /// + INSERT = 0x2D, + + /// + /// DEL key + /// + DELETE = 0x2E, + + /// + /// HELP key + /// + HELP = 0x2F, + + /// + /// 0 key + /// + KEY_0 = 0x30, + + /// + /// 1 key + /// + KEY_1 = 0x31, + + /// + /// 2 key + /// + KEY_2 = 0x32, + + /// + /// 3 key + /// + KEY_3 = 0x33, + + /// + /// 4 key + /// + KEY_4 = 0x34, + + /// + /// 5 key + /// + KEY_5 = 0x35, + + /// + /// 6 key + /// + KEY_6 = 0x36, + + /// + /// 7 key + /// + KEY_7 = 0x37, + + /// + /// 8 key + /// + KEY_8 = 0x38, + + /// + /// 9 key + /// + KEY_9 = 0x39, + + /// + /// A key + /// + KEY_A = 0x41, + + /// + /// B key + /// + KEY_B = 0x42, + + /// + /// C key + /// + KEY_C = 0x43, + + /// + /// D key + /// + KEY_D = 0x44, + + /// + /// E key + /// + KEY_E = 0x45, + + /// + /// F key + /// + KEY_F = 0x46, + + /// + /// G key + /// + KEY_G = 0x47, + + /// + /// H key + /// + KEY_H = 0x48, + + /// + /// I key + /// + KEY_I = 0x49, + + /// + /// J key + /// + KEY_J = 0x4A, + + /// + /// K key + /// + KEY_K = 0x4B, + + /// + /// L key + /// + KEY_L = 0x4C, + + /// + /// M key + /// + KEY_M = 0x4D, + + /// + /// N key + /// + KEY_N = 0x4E, + + /// + /// O key + /// + KEY_O = 0x4F, + + /// + /// P key + /// + KEY_P = 0x50, + + /// + /// Q key + /// + KEY_Q = 0x51, + + /// + /// R key + /// + KEY_R = 0x52, + + /// + /// S key + /// + KEY_S = 0x53, + + /// + /// T key + /// + KEY_T = 0x54, + + /// + /// U key + /// + KEY_U = 0x55, + + /// + /// V key + /// + KEY_V = 0x56, + + /// + /// W key + /// + KEY_W = 0x57, + + /// + /// X key + /// + KEY_X = 0x58, + + /// + /// Y key + /// + KEY_Y = 0x59, + + /// + /// Z key + /// + KEY_Z = 0x5A, + + /// + /// Left Windows key (Microsoft Natural keyboard) + /// + LWIN = 0x5B, + + /// + /// Right Windows key (Natural keyboard) + /// + RWIN = 0x5C, + + /// + /// Applications key (Natural keyboard) + /// + APPS = 0x5D, + + /// + /// Computer Sleep key + /// + SLEEP = 0x5F, + + /// + /// Numeric keypad 0 key + /// + NUMPAD0 = 0x60, + + /// + /// Numeric keypad 1 key + /// + NUMPAD1 = 0x61, + + /// + /// Numeric keypad 2 key + /// + NUMPAD2 = 0x62, + + /// + /// Numeric keypad 3 key + /// + NUMPAD3 = 0x63, + + /// + /// Numeric keypad 4 key + /// + NUMPAD4 = 0x64, + + /// + /// Numeric keypad 5 key + /// + NUMPAD5 = 0x65, + + /// + /// Numeric keypad 6 key + /// + NUMPAD6 = 0x66, + + /// + /// Numeric keypad 7 key + /// + NUMPAD7 = 0x67, + + /// + /// Numeric keypad 8 key + /// + NUMPAD8 = 0x68, + + /// + /// Numeric keypad 9 key + /// + NUMPAD9 = 0x69, + + /// + /// Multiply key + /// + MULTIPLY = 0x6A, + + /// + /// Add key + /// + ADD = 0x6B, + + /// + /// Separator key + /// + SEPARATOR = 0x6C, + + /// + /// Subtract key + /// + SUBTRACT = 0x6D, + + /// + /// Decimal key + /// + DECIMAL = 0x6E, + + /// + /// Divide key + /// + DIVIDE = 0x6F, + + /// + /// F1 key + /// + F1 = 0x70, + + /// + /// F2 key + /// + F2 = 0x71, + + /// + /// F3 key + /// + F3 = 0x72, + + /// + /// F4 key + /// + F4 = 0x73, + + /// + /// F5 key + /// + F5 = 0x74, + + /// + /// F6 key + /// + F6 = 0x75, + + /// + /// F7 key + /// + F7 = 0x76, + + /// + /// F8 key + /// + F8 = 0x77, + + /// + /// F9 key + /// + F9 = 0x78, + + /// + /// F10 key + /// + F10 = 0x79, + + /// + /// F11 key + /// + F11 = 0x7A, + + /// + /// F12 key + /// + F12 = 0x7B, + + /// + /// F13 key + /// + F13 = 0x7C, + + /// + /// F14 key + /// + F14 = 0x7D, + + /// + /// F15 key + /// + F15 = 0x7E, + + /// + /// F16 key + /// + F16 = 0x7F, + + /// + /// F17 key + /// + F17 = 0x80, + + /// + /// F18 key + /// + F18 = 0x81, + + /// + /// F19 key + /// + F19 = 0x82, + + /// + /// F20 key + /// + F20 = 0x83, + + /// + /// F21 key + /// + F21 = 0x84, + + /// + /// F22 key, (PPC only) Key used to lock device. + /// + F22 = 0x85, + + /// + /// F23 key + /// + F23 = 0x86, + + /// + /// F24 key + /// + F24 = 0x87, + + /// + /// NUM LOCK key + /// + NUMLOCK = 0x90, + + /// + /// SCROLL LOCK key + /// + SCROLL = 0x91, + + /// + /// Left SHIFT key + /// + LSHIFT = 0xA0, + + /// + /// Right SHIFT key + /// + RSHIFT = 0xA1, + + /// + /// Left CONTROL key + /// + LCONTROL = 0xA2, + + /// + /// Right CONTROL key + /// + RCONTROL = 0xA3, + + /// + /// Left MENU key + /// + LMENU = 0xA4, + + /// + /// Right MENU key + /// + RMENU = 0xA5, + + /// + /// Windows 2000/XP: Browser Back key + /// + BROWSER_BACK = 0xA6, + + /// + /// Windows 2000/XP: Browser Forward key + /// + BROWSER_FORWARD = 0xA7, + + /// + /// Windows 2000/XP: Browser Refresh key + /// + BROWSER_REFRESH = 0xA8, + + /// + /// Windows 2000/XP: Browser Stop key + /// + BROWSER_STOP = 0xA9, + + /// + /// Windows 2000/XP: Browser Search key + /// + BROWSER_SEARCH = 0xAA, + + /// + /// Windows 2000/XP: Browser Favorites key + /// + BROWSER_FAVORITES = 0xAB, + + /// + /// Windows 2000/XP: Browser Start and Home key + /// + BROWSER_HOME = 0xAC, + + /// + /// Windows 2000/XP: Volume Mute key + /// + VOLUME_MUTE = 0xAD, + + /// + /// Windows 2000/XP: Volume Down key + /// + VOLUME_DOWN = 0xAE, + + /// + /// Windows 2000/XP: Volume Up key + /// + VOLUME_UP = 0xAF, + + /// + /// Windows 2000/XP: Next Track key + /// + MEDIA_NEXT_TRACK = 0xB0, + + /// + /// Windows 2000/XP: Previous Track key + /// + MEDIA_PREV_TRACK = 0xB1, + + /// + /// Windows 2000/XP: Stop Media key + /// + MEDIA_STOP = 0xB2, + + /// + /// Windows 2000/XP: Play/Pause Media key + /// + MEDIA_PLAY_PAUSE = 0xB3, + + /// + /// Windows 2000/XP: Start Mail key + /// + LAUNCH_MAIL = 0xB4, + + /// + /// Windows 2000/XP: Select Media key + /// + LAUNCH_MEDIA_SELECT = 0xB5, + + /// + /// Windows 2000/XP: Start Application 1 key + /// + LAUNCH_APP1 = 0xB6, + + /// + /// Windows 2000/XP: Start Application 2 key + /// + LAUNCH_APP2 = 0xB7, + + /// + /// Used for miscellaneous characters; it can vary by keyboard. + /// + OEM_1 = 0xBA, + + /// + /// Windows 2000/XP: For any country/region, the '+' key + /// + OEM_PLUS = 0xBB, + + /// + /// Windows 2000/XP: For any country/region, the ',' key + /// + OEM_COMMA = 0xBC, + + /// + /// Windows 2000/XP: For any country/region, the '-' key + /// + OEM_MINUS = 0xBD, + + /// + /// Windows 2000/XP: For any country/region, the '.' key + /// + OEM_PERIOD = 0xBE, + + /// + /// Used for miscellaneous characters; it can vary by keyboard. + /// + OEM_2 = 0xBF, + + /// + /// Used for miscellaneous characters; it can vary by keyboard. + /// + OEM_3 = 0xC0, + + /// + /// Used for miscellaneous characters; it can vary by keyboard. + /// + OEM_4 = 0xDB, + + /// + /// Used for miscellaneous characters; it can vary by keyboard. + /// + OEM_5 = 0xDC, + + /// + /// Used for miscellaneous characters; it can vary by keyboard. + /// + OEM_6 = 0xDD, + + /// + /// Used for miscellaneous characters; it can vary by keyboard. + /// + OEM_7 = 0xDE, + + /// + /// Used for miscellaneous characters; it can vary by keyboard. + /// + OEM_8 = 0xDF, + + /// + /// Windows 2000/XP: Either the angle bracket key or the backslash key on the RT 102-key keyboard + /// + OEM_102 = 0xE2, + + /// + /// Windows 95/98/Me, Windows NT 4.0, Windows 2000/XP: IME PROCESS key + /// + PROCESSKEY = 0xE5, + + /// + /// Windows 2000/XP: Used to pass Unicode characters as if they were keystrokes. + /// The VK_PACKET key is the low word of a 32-bit Virtual Key value used for non-keyboard input methods. For more + /// information, + /// see Remark in KEYBDINPUT, SendInput, WM_KEYDOWN, and WM_KEYUP + /// + PACKET = 0xE7, + + /// + /// Attn key + /// + ATTN = 0xF6, + + /// + /// CrSel key + /// + CRSEL = 0xF7, + + /// + /// ExSel key + /// + EXSEL = 0xF8, + + /// + /// Erase EOF key + /// + EREOF = 0xF9, + + /// + /// Play key + /// + PLAY = 0xFA, + + /// + /// Zoom key + /// + ZOOM = 0xFB, + + /// + /// Reserved + /// + NONAME = 0xFC, + + /// + /// PA1 key + /// + PA1 = 0xFD, + + /// + /// Clear key + /// + OEM_CLEAR = 0xFE + } + + /// + /// These are the hardware keyboard codes + /// + public enum ScanCodeShort : ushort + { + ESCAPE = 0x01, + ESC = ESCAPE, + KEY_1 = 0x02, + KEY_2 = 0x03, + KEY_3 = 0x04, + KEY_4 = 0x05, + KEY_5 = 0x06, + KEY_6 = 0x07, + KEY_7 = 0x08, + KEY_8 = 0x09, + KEY_9 = 0x0A, + KEY_0 = 0x0B, + OEM_MINUS = 0x0C, + OEM_PLUS = 0x0D, + BACK = 0x0E, + TAB = 0x0F, + KEY_Q = 0x10, + KEY_W = 0x11, + KEY_E = 0x12, + KEY_R = 0x13, + KEY_T = 0x14, + KEY_Y = 0x15, + KEY_U = 0x16, + KEY_I = 0x17, + KEY_O = 0x18, + KEY_P = 0x19, + OPENBRACKET = 0x1A, + CLOSEBRACKET = 0x1B, + RETURN = 0x1C, + ENTER = RETURN, + CONTROL = 0x1D, + KEY_A = 0x1E, + KEY_S = 0x1F, + KEY_D = 0x20, + KEY_F = 0x21, + KEY_G = 0x22, + KEY_H = 0x23, + KEY_J = 0x24, + KEY_K = 0x25, + KEY_L = 0x26, + SEMICOLON = 0x27, + QUOTE = 0x28, + TILDE = 0x29, + SHIFT = 0x2A, + PIPE = 0x2B, + KEY_Z = 0x2C, + KEY_X = 0x2D, + KEY_C = 0x2E, + KEY_V = 0x2F, + KEY_B = 0x30, + KEY_N = 0x31, + KEY_M = 0x32, + COMMA = 0x33, + PERIOD = 0x34, + DIVIDE = 0x35, + RSHIFT = 0x36, + MULTIPLY = 0x37, + ALT = 0x38, + SPACE = 0x39, + CAPSLOCK = 0x3A, + F1 = 0x3B, + F2 = 0x3C, + F3 = 0x3D, + F4 = 0x3E, + F5 = 0x3F, + F6 = 0x40, + F7 = 0x41, + F8 = 0x42, + F9 = 0x43, + F10 = 0x44, + NUMLOCK = 0x45, + PAUSE = 0x46, + NUMPAD7 = 0x47, + NUMPAD8 = 0x48, + NUMPAD9 = 0x49, + SUBTRACT = 0x4A, + NUMPAD4 = 0x4B, + NUMPAD5 = 0x4C, + NUMPAD6 = 0x4D, + ADD = 0x4E, + NUMPAD1 = 0x4F, + NUMPAD2 = 0x50, + NUMPAD3 = 0x51, + NUMPAD0 = 0x52, + DELETE = 0x53, + SNAPSHOT = 0x54, + OEM_102 = 0x56, + F11 = 0x57, + F12 = 0x58, + LWIN = 0x5B, + RWIN = 0x5C, + WINMENU = 0x5D, + POWER = 0x5E, + SLEEP = 0x5F, + ZOOM = 0x62, + HELP = 0x63, + F13 = 0x64, + F14 = 0x65, + F15 = 0x66, + F16 = 0x67, + F17 = 0x68, + F18 = 0x69, + F19 = 0x6A, + F20 = 0x6B, + F21 = 0x6C, + F22 = 0x6D, + F23 = 0x6E, + F24 = 0x76 + } + + [Flags] + public enum KeyEventFlags : uint + { + KEYEVENTF_KEYDOWN = 0x0000, + KEYEVENTF_EXTENDEDKEY = 0x0001, + KEYEVENTF_KEYUP = 0x0002, + KEYEVENTF_UNICODE = 0x0004, + KEYEVENTF_SCANCODE = 0x0008 + } + + [Flags] + public enum SendMessageTimeoutFlags : uint + { + SMTO_NORMAL = 0x0, + SMTO_BLOCK = 0x1, + SMTO_ABORTIFHUNG = 0x2, + SMTO_NOTIMEOUTIFNOTHUNG = 0x8, + SMTO_ERRORONEXIT = 0x20 + } + + [Flags] + public enum AccessibilityState : uint + { + STATE_SYSTEM_UNAVAILABLE = 0x00000001, + STATE_SYSTEM_SELECTED = 0x00000002, + STATE_SYSTEM_FOCUSED = 0x00000004, + STATE_SYSTEM_PRESSED = 0x00000008, + STATE_SYSTEM_CHECKED = 0x00000010, + STATE_SYSTEM_MIXED = 0x00000020, + STATE_SYSTEM_READONLY = 0x00000040, + STATE_SYSTEM_HOTTRACKED = 0x00000080, + STATE_SYSTEM_DEFAULT = 0x00000100, + STATE_SYSTEM_EXPANDED = 0x00000200, + STATE_SYSTEM_COLLAPSED = 0x00000400, + STATE_SYSTEM_BUSY = 0x00000800, + STATE_SYSTEM_FLOATING = 0x00001000, + STATE_SYSTEM_MARQUEED = 0x00002000, + STATE_SYSTEM_ANIMATED = 0x00004000, + STATE_SYSTEM_INVISIBLE = 0x00008000, + STATE_SYSTEM_OFFSCREEN = 0x00010000, + STATE_SYSTEM_SIZEABLE = 0x00020000, + STATE_SYSTEM_MOVEABLE = 0x00040000, + STATE_SYSTEM_SELFVOICING = 0x00080000, + STATE_SYSTEM_FOCUSABLE = 0x00100000, + STATE_SYSTEM_SELECTABLE = 0x00200000, + STATE_SYSTEM_LINKED = 0x00400000, + STATE_SYSTEM_TRAVERSED = 0x00800000, + STATE_SYSTEM_MULTISELECTABLE = 0x01000000, + STATE_SYSTEM_EXTSELECTABLE = 0x02000000, + STATE_SYSTEM_ALERT_LOW = 0x04000000, + STATE_SYSTEM_ALERT_MEDIUM = 0x08000000, + STATE_SYSTEM_ALERT_HIGH = 0x10000000, + STATE_SYSTEM_VALID = 0x1FFFFFFF + } + + public enum AccessibilityRole : uint + { + ROLE_SYSTEM_TITLEBAR = 0x00000001, + ROLE_SYSTEM_MENUBAR = 0x00000002, + ROLE_SYSTEM_SCROLLBAR = 0x00000003, + ROLE_SYSTEM_GRIP = 0x00000004, + ROLE_SYSTEM_SOUND = 0x00000005, + ROLE_SYSTEM_CURSOR = 0x00000006, + ROLE_SYSTEM_CARET = 0x00000007, + ROLE_SYSTEM_ALERT = 0x00000008, + ROLE_SYSTEM_WINDOW = 0x00000009, + ROLE_SYSTEM_CLIENT = 0x0000000A, + ROLE_SYSTEM_MENUPOPUP = 0x0000000B, + ROLE_SYSTEM_MENUITEM = 0x0000000C, + ROLE_SYSTEM_TOOLTIP = 0x0000000D, + ROLE_SYSTEM_APPLICATION = 0x0000000E, + ROLE_SYSTEM_DOCUMENT = 0x0000000F, + ROLE_SYSTEM_PANE = 0x00000010, + ROLE_SYSTEM_CHART = 0x00000011, + ROLE_SYSTEM_DIALOG = 0x00000012, + ROLE_SYSTEM_BORDER = 0x00000013, + ROLE_SYSTEM_GROUPING = 0x00000014, + ROLE_SYSTEM_SEPARATOR = 0x00000015, + ROLE_SYSTEM_TOOLBAR = 0x00000016, + ROLE_SYSTEM_STATUSBAR = 0x00000017, + ROLE_SYSTEM_TABLE = 0x00000018, + ROLE_SYSTEM_COLUMNHEADER = 0x00000019, + ROLE_SYSTEM_ROWHEADER = 0x0000001A, + ROLE_SYSTEM_COLUMN = 0x0000001B, + ROLE_SYSTEM_ROW = 0x0000001C, + ROLE_SYSTEM_CELL = 0x0000001D, + ROLE_SYSTEM_LINK = 0x0000001E, + ROLE_SYSTEM_HELPBALLOON = 0x0000001F, + ROLE_SYSTEM_CHARACTER = 0x00000020, + ROLE_SYSTEM_LIST = 0x00000021, + ROLE_SYSTEM_LISTITEM = 0x00000022, + ROLE_SYSTEM_OUTLINE = 0x00000023, + ROLE_SYSTEM_OUTLINEITEM = 0x00000024, + ROLE_SYSTEM_PAGETAB = 0x00000025, + ROLE_SYSTEM_PROPERTYPAGE = 0x00000026, + ROLE_SYSTEM_INDICATOR = 0x00000027, + ROLE_SYSTEM_GRAPHIC = 0x00000028, + ROLE_SYSTEM_STATICTEXT = 0x00000029, + ROLE_SYSTEM_TEXT = 0x0000002A, + ROLE_SYSTEM_PUSHBUTTON = 0x0000002B, + ROLE_SYSTEM_CHECKBUTTON = 0x0000002C, + ROLE_SYSTEM_RADIOBUTTON = 0x0000002D, + ROLE_SYSTEM_COMBOBOX = 0x0000002E, + ROLE_SYSTEM_DROPLIST = 0x0000002F, + ROLE_SYSTEM_PROGRESSBAR = 0x00000030, + ROLE_SYSTEM_DIAL = 0x00000031, + ROLE_SYSTEM_HOTKEYFIELD = 0x00000032, + ROLE_SYSTEM_SLIDER = 0x00000033, + ROLE_SYSTEM_SPINBUTTON = 0x00000034, + ROLE_SYSTEM_DIAGRAM = 0x00000035, + ROLE_SYSTEM_ANIMATION = 0x00000036, + ROLE_SYSTEM_EQUATION = 0x00000037, + ROLE_SYSTEM_BUTTONDROPDOWN = 0x00000038, + ROLE_SYSTEM_BUTTONMENU = 0x00000039, + ROLE_SYSTEM_BUTTONDROPDOWNGRID = 0x0000003A, + ROLE_SYSTEM_WHITESPACE = 0x0000003B, + ROLE_SYSTEM_PAGETABLIST = 0x0000003C, + ROLE_SYSTEM_CLOCK = 0x0000003D + } + + public enum CursorState + { + /// + /// The cursor is hidden. + /// + CURSOR_HIDING = 0x00000000, + + /// + /// The cursor is showing. + /// + CURSOR_SHOWING = 0x00000001, + + /// + /// Windows 8: The cursor is suppressed. This flag indicates that the system is not drawing + /// the cursor because the user is providing input through touch or pen instead of the mouse. + /// + CURSOR_SUPPRESSED = 0x00000002 + } + + public enum StretchMode + { + STRETCH_ANDSCANS = 1, + STRETCH_ORSCANS = 2, + STRETCH_DELETESCANS = 3, + STRETCH_HALFTONE = 4, + } + + /// + /// Specifies a raster-operation code. These codes define how the color data for the + /// source rectangle is to be combined with the color data for the destination + /// rectangle to achieve the final color. + /// + public enum TernaryRasterOperations : uint + { + /// dest = source + SRCCOPY = 0x00CC0020, + /// dest = source OR dest + SRCPAINT = 0x00EE0086, + /// dest = source AND dest + SRCAND = 0x008800C6, + /// dest = source XOR dest + SRCINVERT = 0x00660046, + /// dest = source AND (NOT dest) + SRCERASE = 0x00440328, + /// dest = (NOT source) + NOTSRCCOPY = 0x00330008, + /// dest = (NOT src) AND (NOT dest) + NOTSRCERASE = 0x001100A6, + /// dest = (source AND pattern) + MERGECOPY = 0x00C000CA, + /// dest = (NOT source) OR dest + MERGEPAINT = 0x00BB0226, + /// dest = pattern + PATCOPY = 0x00F00021, + /// dest = DPSnoo + PATPAINT = 0x00FB0A09, + /// dest = pattern XOR dest + PATINVERT = 0x005A0049, + /// dest = (NOT dest) + DSTINVERT = 0x00550009, + /// dest = BLACK + BLACKNESS = 0x00000042, + /// dest = WHITE + WHITENESS = 0x00FF0062, + /// + /// Capture window as seen on screen. This includes layered windows + /// such as WPF windows with AllowsTransparency="true" + /// + CAPTUREBLT = 0x40000000 + } + + internal class Win32Constants + { + public static IntPtr TRUE = new IntPtr(1); + public static IntPtr FALSE = new IntPtr(0); + } +} +#pragma warning restore diff --git a/src/FlaUI.Core/WindowsAPI/Delegates.cs b/src/FlaUI.Core/WindowsAPI/Delegates.cs index 66ab7e0bd..41c8cc6c9 100644 --- a/src/FlaUI.Core/WindowsAPI/Delegates.cs +++ b/src/FlaUI.Core/WindowsAPI/Delegates.cs @@ -4,6 +4,6 @@ namespace FlaUI.Core.WindowsAPI { public static class Delegates { - public delegate bool MonitorEnumDelegate(IntPtr hMonitor, IntPtr hdcMonitor, ref Rect lprcMonitor, IntPtr dwData); + public delegate bool MonitorEnumDelegate(IntPtr hMonitor, IntPtr hdcMonitor, ref RECT lprcMonitor, IntPtr dwData); } } diff --git a/src/FlaUI.Core/WindowsAPI/Structures.cs b/src/FlaUI.Core/WindowsAPI/Structures.cs index ccbd5cec8..ecdc62415 100644 --- a/src/FlaUI.Core/WindowsAPI/Structures.cs +++ b/src/FlaUI.Core/WindowsAPI/Structures.cs @@ -1,164 +1,164 @@ -using System; -using System.Drawing; -using System.Runtime.InteropServices; - -// ReSharper disable InconsistentNaming -#pragma warning disable -namespace FlaUI.Core.WindowsAPI -{ - [StructLayout(LayoutKind.Sequential)] - public struct POINT - { - public int X; - public int Y; - } - - [StructLayout(LayoutKind.Sequential)] - public struct COLORREF - { - public byte R; - public byte G; - public byte B; - - public COLORREF(byte r, byte g, byte b) - { - R = r; - G = g; - B = b; - } - - public static implicit operator Color(COLORREF c) - { - return Color.FromArgb(c.R, c.G, c.B); - } - - public static implicit operator COLORREF(Color c) - { - return new COLORREF(c.R, c.G, c.B); - } - -#if NETFRAMEWORK - public static implicit operator System.Windows.Media.Color(COLORREF c) - { - return System.Windows.Media.Color.FromRgb(c.R, c.G, c.B); - } - - public static implicit operator COLORREF(System.Windows.Media.Color c) - { - return new COLORREF(c.R, c.G, c.B); - } -#endif - - public override string ToString() - { - return $"R={R},G={G},B={B}"; - } - } - - [StructLayout(LayoutKind.Sequential)] - public struct INPUT - { - public InputType type; - public INPUTUNION u; - - public static int Size => Marshal.SizeOf(typeof(INPUT)); - - public static INPUT MouseInput(MOUSEINPUT mouseInput) - { - return new INPUT { type = InputType.INPUT_MOUSE, u = new INPUTUNION { mi = mouseInput } }; - } - - public static INPUT KeyboardInput(KEYBDINPUT keyboardInput) - { - return new INPUT { type = InputType.INPUT_KEYBOARD, u = new INPUTUNION { ki = keyboardInput } }; - } - - public static INPUT HardwareInput(HARDWAREINPUT hardwareInput) - { - return new INPUT { type = InputType.INPUT_HARDWARE, u = new INPUTUNION { hi = hardwareInput } }; - } - } - - [StructLayout(LayoutKind.Explicit)] - public struct INPUTUNION - { - [FieldOffset(0)] public MOUSEINPUT mi; - - [FieldOffset(0)] public KEYBDINPUT ki; - - [FieldOffset(0)] public HARDWAREINPUT hi; - } - - [StructLayout(LayoutKind.Sequential)] - public struct MOUSEINPUT - { - public int dx; - public int dy; - public uint mouseData; - public MouseEventFlags dwFlags; - public uint time; - public IntPtr dwExtraInfo; - } - - [StructLayout(LayoutKind.Sequential)] - public struct KEYBDINPUT - { - public ushort wVk; - public ushort wScan; - public KeyEventFlags dwFlags; - public uint time; - public IntPtr dwExtraInfo; - } - - [StructLayout(LayoutKind.Sequential)] - public struct HARDWAREINPUT - { - public uint uMsg; - public ushort wParamL; - public ushort wParamH; - } - - [StructLayout(LayoutKind.Sequential)] - public struct CURSORINFO - { - public Int32 cbSize; - public CursorState flags; - public IntPtr hCursor; - public POINT ptScreenPos; - } - - [StructLayout(LayoutKind.Sequential)] - public struct ICONINFO - { - public bool fIcon; - public int xHotspot; - public int yHotspot; - public IntPtr hbmMask; - public IntPtr hbmColor; - } - - [StructLayout(LayoutKind.Sequential)] - public struct Rect - { - public int left; - public int top; - public int right; - public int bottom; - - public override string ToString() - { - return $"{{X={left},Y={top},Width={right - left},Height={bottom - top}}}"; - } - } - - [StructLayout(LayoutKind.Sequential)] - public struct MonitorInfo - { - public uint size; - public Rect monitor; - public Rect work; - public uint flags; - } - -} -#pragma warning restore +using System; +using System.Drawing; +using System.Runtime.InteropServices; + +// ReSharper disable InconsistentNaming +#pragma warning disable +namespace FlaUI.Core.WindowsAPI +{ + [StructLayout(LayoutKind.Sequential)] + public struct POINT + { + public int X; + public int Y; + } + + [StructLayout(LayoutKind.Sequential)] + public struct COLORREF + { + public byte R; + public byte G; + public byte B; + + public COLORREF(byte r, byte g, byte b) + { + R = r; + G = g; + B = b; + } + + public static implicit operator Color(COLORREF c) + { + return Color.FromArgb(c.R, c.G, c.B); + } + + public static implicit operator COLORREF(Color c) + { + return new COLORREF(c.R, c.G, c.B); + } + +#if NETFRAMEWORK + public static implicit operator System.Windows.Media.Color(COLORREF c) + { + return System.Windows.Media.Color.FromRgb(c.R, c.G, c.B); + } + + public static implicit operator COLORREF(System.Windows.Media.Color c) + { + return new COLORREF(c.R, c.G, c.B); + } +#endif + + public override string ToString() + { + return $"R={R},G={G},B={B}"; + } + } + + [StructLayout(LayoutKind.Sequential)] + public struct INPUT + { + public InputType type; + public INPUTUNION u; + + public static int Size => Marshal.SizeOf(typeof(INPUT)); + + public static INPUT MouseInput(MOUSEINPUT mouseInput) + { + return new INPUT { type = InputType.INPUT_MOUSE, u = new INPUTUNION { mi = mouseInput } }; + } + + public static INPUT KeyboardInput(KEYBDINPUT keyboardInput) + { + return new INPUT { type = InputType.INPUT_KEYBOARD, u = new INPUTUNION { ki = keyboardInput } }; + } + + public static INPUT HardwareInput(HARDWAREINPUT hardwareInput) + { + return new INPUT { type = InputType.INPUT_HARDWARE, u = new INPUTUNION { hi = hardwareInput } }; + } + } + + [StructLayout(LayoutKind.Explicit)] + public struct INPUTUNION + { + [FieldOffset(0)] public MOUSEINPUT mi; + + [FieldOffset(0)] public KEYBDINPUT ki; + + [FieldOffset(0)] public HARDWAREINPUT hi; + } + + [StructLayout(LayoutKind.Sequential)] + public struct MOUSEINPUT + { + public int dx; + public int dy; + public uint mouseData; + public MouseEventFlags dwFlags; + public uint time; + public IntPtr dwExtraInfo; + } + + [StructLayout(LayoutKind.Sequential)] + public struct KEYBDINPUT + { + public ushort wVk; + public ushort wScan; + public KeyEventFlags dwFlags; + public uint time; + public IntPtr dwExtraInfo; + } + + [StructLayout(LayoutKind.Sequential)] + public struct HARDWAREINPUT + { + public uint uMsg; + public ushort wParamL; + public ushort wParamH; + } + + [StructLayout(LayoutKind.Sequential)] + public struct CURSORINFO + { + public Int32 cbSize; + public CursorState flags; + public IntPtr hCursor; + public POINT ptScreenPos; + } + + [StructLayout(LayoutKind.Sequential)] + public struct ICONINFO + { + public bool fIcon; + public int xHotspot; + public int yHotspot; + public IntPtr hbmMask; + public IntPtr hbmColor; + } + + [StructLayout(LayoutKind.Sequential)] + public struct RECT + { + public int left; + public int top; + public int right; + public int bottom; + + public override string ToString() + { + return $"{{X={left},Y={top},Width={right - left},Height={bottom - top}}}"; + } + } + + [StructLayout(LayoutKind.Sequential)] + public struct MonitorInfo + { + public uint size; + public RECT monitor; + public RECT work; + public uint flags; + } + +} +#pragma warning restore diff --git a/src/FlaUI.Core/WindowsAPI/User32.cs b/src/FlaUI.Core/WindowsAPI/User32.cs index eff7e8a1e..1436843e0 100644 --- a/src/FlaUI.Core/WindowsAPI/User32.cs +++ b/src/FlaUI.Core/WindowsAPI/User32.cs @@ -1,108 +1,108 @@ -using System; -using System.Runtime.InteropServices; -using System.Text; - -namespace FlaUI.Core.WindowsAPI -{ -#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member - public static class User32 - { - [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)] - public static extern uint GetWindowLong(IntPtr hWnd, int nIndex); - - [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)] - public static extern int SetWindowLong(IntPtr hWnd, int nIndex, UInt32 dwNewLong); - - [DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true, SetLastError = true)] - [return: MarshalAs(UnmanagedType.Bool)] - public static extern bool SetWindowPos(IntPtr hWnd, IntPtr hwndAfter, int x, int y, int width, int height, int flags); - - [DllImport("user32.dll", SetLastError = true)] - public static extern bool SetForegroundWindow(IntPtr windowHandle); - - [DllImport("user32.dll", SetLastError = true)] - public static extern IntPtr SetFocus(IntPtr hWnd); - - [DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true, SetLastError = true)] - internal static extern bool ShowWindow(IntPtr hWnd, int nCmdShow); - - [DllImport("user32.dll", SetLastError = true)] - public static extern bool SetLayeredWindowAttributes(IntPtr hwnd, uint crKey, byte bAlpha, uint dwFlags); - - [DllImport("user32.dll", SetLastError = true)] - public static extern bool GetCursorPos(out POINT lpPoint); - - [DllImport("user32.dll", SetLastError = true)] - public static extern bool SetCursorPos(int x, int y); - - [DllImport("user32.dll", SetLastError = true)] - public static extern uint GetDoubleClickTime(); - - [DllImport("user32.dll", SetLastError = true)] - public static extern int GetSystemMetrics(SystemMetric nIndex); - - [DllImport("user32.dll", SetLastError = true)] - public static extern IntPtr GetMessageExtraInfo(); - - [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)] - public static extern IntPtr SendMessageTimeout(IntPtr hWnd, uint msg, UIntPtr wParam, IntPtr lParam, SendMessageTimeoutFlags fuFlags, uint uTimeout, out UIntPtr lpdwResult); - - [DllImport("user32.dll", CharSet = CharSet.Auto)] - public static extern IntPtr SendMessage(IntPtr hWnd, UInt32 Msg, IntPtr wParam, IntPtr lParam); - - [DllImport("user32.dll", EntryPoint = "SendMessage", CharSet = CharSet.Auto)] - public static extern bool SendMessage(IntPtr hWnd, uint Msg, int wParam, StringBuilder lParam); - - [DllImport("user32.dll", SetLastError = true)] - public static extern uint SendInput(uint nInputs, [MarshalAs(UnmanagedType.LPArray), In] INPUT[] pInputs, int cbSize); - - [DllImport("user32.dll", CharSet = CharSet.Unicode, SetLastError = true)] - public static extern short VkKeyScan(char ch); - - [DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true, CallingConvention = CallingConvention.Winapi)] - public static extern short GetKeyState(int keyCode); - - [DllImport("user32.dll")] - public static extern bool GetCursorInfo(out CURSORINFO pci); - - [DllImport("user32.dll")] - public static extern bool DrawIcon(IntPtr hDC, int x, int y, IntPtr hIcon); - - [DllImport("user32.dll", SetLastError = true)] - public static extern bool DrawIconEx(IntPtr hdc, int xLeft, int yTop, IntPtr hIcon, int cxWidth, int cyHeight, int istepIfAniCur, IntPtr hbrFlickerFreeDraw, int diFlags); - - [DllImport("user32.dll", EntryPoint = "CopyIcon")] - public static extern IntPtr CopyIcon(IntPtr hIcon); - - [DllImport("user32.dll", SetLastError = true)] - public static extern bool DestroyIcon(IntPtr hIcon); - - [DllImport("user32.dll", EntryPoint = "GetIconInfo")] - public static extern bool GetIconInfo(IntPtr hIcon, out ICONINFO piconinfo); - - [DllImport("user32.dll")] - public static extern bool ReleaseDC(IntPtr hWnd, IntPtr hDc); - - [DllImport("user32.dll")] - public static extern IntPtr GetDesktopWindow(); - - [DllImport("user32.dll")] - public static extern IntPtr GetWindowDC(IntPtr ptr); - - [DllImport("user32.dll")] - public static extern bool EnumDisplayMonitors(IntPtr hdc, IntPtr lprcClip, Delegates.MonitorEnumDelegate lpfnEnum, IntPtr dwData); - - [DllImport("user32.dll")] - public static extern bool GetMonitorInfo(IntPtr hmon, ref MonitorInfo mi); - - [DllImport("user32.dll", SetLastError = true)] - public static extern uint GetWindowThreadProcessId(IntPtr hWnd, out uint lpdwProcessId); - - [DllImport("user32.dll")] - public static extern bool AttachThreadInput(uint idAttach, uint idAttachTo, bool fAttach); - - [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)] - public static extern int GetClassName(IntPtr hWnd, StringBuilder lpClassName, int nMaxCount); - } -#pragma warning restore CS1591 // Missing XML comment for publicly visible type or member -} +using System; +using System.Runtime.InteropServices; +using System.Text; + +namespace FlaUI.Core.WindowsAPI +{ +#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member + public static class User32 + { + [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)] + public static extern uint GetWindowLong(IntPtr hWnd, int nIndex); + + [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)] + public static extern int SetWindowLong(IntPtr hWnd, int nIndex, UInt32 dwNewLong); + + [DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true, SetLastError = true)] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool SetWindowPos(IntPtr hWnd, IntPtr hwndAfter, int x, int y, int width, int height, int flags); + + [DllImport("user32.dll", SetLastError = true)] + public static extern bool SetForegroundWindow(IntPtr windowHandle); + + [DllImport("user32.dll", SetLastError = true)] + public static extern IntPtr SetFocus(IntPtr hWnd); + + [DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true, SetLastError = true)] + internal static extern bool ShowWindow(IntPtr hWnd, int nCmdShow); + + [DllImport("user32.dll", SetLastError = true)] + public static extern bool SetLayeredWindowAttributes(IntPtr hwnd, uint crKey, byte bAlpha, uint dwFlags); + + [DllImport("user32.dll", SetLastError = true)] + public static extern bool GetCursorPos(out POINT lpPoint); + + [DllImport("user32.dll", SetLastError = true)] + public static extern bool SetCursorPos(int x, int y); + + [DllImport("user32.dll", SetLastError = true)] + public static extern uint GetDoubleClickTime(); + + [DllImport("user32.dll", SetLastError = true)] + public static extern int GetSystemMetrics(SystemMetric nIndex); + + [DllImport("user32.dll", SetLastError = true)] + public static extern IntPtr GetMessageExtraInfo(); + + [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)] + public static extern IntPtr SendMessageTimeout(IntPtr hWnd, uint msg, UIntPtr wParam, IntPtr lParam, SendMessageTimeoutFlags fuFlags, uint uTimeout, out UIntPtr lpdwResult); + + [DllImport("user32.dll", CharSet = CharSet.Auto)] + public static extern IntPtr SendMessage(IntPtr hWnd, UInt32 Msg, IntPtr wParam, IntPtr lParam); + + [DllImport("user32.dll", EntryPoint = "SendMessage", CharSet = CharSet.Auto)] + public static extern bool SendMessage(IntPtr hWnd, uint Msg, int wParam, StringBuilder lParam); + + [DllImport("user32.dll", SetLastError = true)] + public static extern uint SendInput(uint nInputs, [MarshalAs(UnmanagedType.LPArray), In] INPUT[] pInputs, int cbSize); + + [DllImport("user32.dll", CharSet = CharSet.Unicode, SetLastError = true)] + public static extern short VkKeyScan(char ch); + + [DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true, CallingConvention = CallingConvention.Winapi)] + public static extern short GetKeyState(int keyCode); + + [DllImport("user32.dll")] + public static extern bool GetCursorInfo(out CURSORINFO pci); + + [DllImport("user32.dll")] + public static extern bool DrawIcon(IntPtr hDC, int x, int y, IntPtr hIcon); + + [DllImport("user32.dll", SetLastError = true)] + public static extern bool DrawIconEx(IntPtr hdc, int xLeft, int yTop, IntPtr hIcon, int cxWidth, int cyHeight, int istepIfAniCur, IntPtr hbrFlickerFreeDraw, int diFlags); + + [DllImport("user32.dll", EntryPoint = "CopyIcon")] + public static extern IntPtr CopyIcon(IntPtr hIcon); + + [DllImport("user32.dll", SetLastError = true)] + public static extern bool DestroyIcon(IntPtr hIcon); + + [DllImport("user32.dll", EntryPoint = "GetIconInfo")] + public static extern bool GetIconInfo(IntPtr hIcon, out ICONINFO piconinfo); + + [DllImport("user32.dll")] + public static extern bool ReleaseDC(IntPtr hWnd, IntPtr hDc); + + [DllImport("user32.dll")] + public static extern IntPtr GetDesktopWindow(); + + [DllImport("user32.dll")] + public static extern IntPtr GetWindowDC(IntPtr ptr); + + [DllImport("user32.dll")] + public static extern bool EnumDisplayMonitors(IntPtr hdc, IntPtr lprcClip, Delegates.MonitorEnumDelegate lpfnEnum, IntPtr dwData); + + [DllImport("user32.dll")] + public static extern bool GetMonitorInfo(IntPtr hmon, ref MonitorInfo mi); + + [DllImport("user32.dll", SetLastError = true)] + public static extern uint GetWindowThreadProcessId(IntPtr hWnd, out uint lpdwProcessId); + + [DllImport("user32.dll")] + public static extern bool AttachThreadInput(uint idAttach, uint idAttachTo, bool fAttach); + + [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)] + public static extern int GetClassName(IntPtr hWnd, StringBuilder lpClassName, int nMaxCount); + } +#pragma warning restore CS1591 // Missing XML comment for publicly visible type or member +}