00001 #region --- License ---
00002
00003
00004
00005
00006 #endregion
00007
00008 #region --- Using Directives ---
00009
00010 using System;
00011 using System.Drawing;
00012 using System.Runtime.InteropServices;
00013 using System.Text;
00014 using System.Security;
00015
00016 #endregion
00017
00018
00019
00020 #pragma warning disable 3019 // CLS-compliance checking
00021 #pragma warning disable 0649 // struct members not explicitly initialized
00022 #pragma warning disable 0169 // field / method is never used.
00023 #pragma warning disable 0414 // field assigned but never used.
00024
00025 namespace OpenTK.Platform.Windows
00026 {
00027 #region Type aliases
00028
00029 using HWND = System.IntPtr;
00030 using HINSTANCE = System.IntPtr;
00031 using HMENU = System.IntPtr;
00032 using HICON = System.IntPtr;
00033 using HBRUSH = System.IntPtr;
00034 using HCURSOR = System.IntPtr;
00035
00036 using LRESULT = System.IntPtr;
00037 using LPVOID = System.IntPtr;
00038 using LPCTSTR = System.String;
00039
00040 using WPARAM = System.IntPtr;
00041 using LPARAM = System.IntPtr;
00042 using HANDLE = System.IntPtr;
00043 using HRAWINPUT = System.IntPtr;
00044
00045 using BYTE = System.Byte;
00046 using SHORT = System.Int16;
00047 using USHORT = System.UInt16;
00048 using LONG = System.Int32;
00049 using ULONG = System.UInt32;
00050 using WORD = System.Int16;
00051 using DWORD = System.Int32;
00052 using BOOL = System.Boolean;
00053 using INT = System.Int32;
00054 using UINT = System.UInt32;
00055 using LONG_PTR = System.IntPtr;
00056 using ATOM = System.Int32;
00057
00058 using COLORREF = System.Int32;
00059 using RECT = OpenTK.Platform.Windows.Win32Rectangle;
00060 using WNDPROC = System.IntPtr;
00061 using LPDEVMODE = DeviceMode;
00062
00063 using HRESULT = System.IntPtr;
00064 using HMONITOR = System.IntPtr;
00065
00066 using DWORD_PTR = System.IntPtr;
00067 using UINT_PTR = System.UIntPtr;
00068
00069 using TIMERPROC = Functions.TimerProc;
00070
00071 #endregion
00072
00078 internal static class API
00079 {
00080
00081 static API()
00082 {
00083 RawInputHeaderSize = Marshal.SizeOf(typeof(RawInputHeader));
00084 RawInputSize = Marshal.SizeOf(typeof(RawInput));
00085 RawMouseSize = Marshal.SizeOf(typeof(RawMouse));
00086 RawInputDeviceSize = Marshal.SizeOf(typeof(RawInputDevice));
00087 RawInputDeviceListSize = Marshal.SizeOf(typeof(RawInputDeviceList));
00088 RawInputDeviceInfoSize = Marshal.SizeOf(typeof(RawInputDeviceInfo));
00089 PixelFormatDescriptorVersion = 1;
00090 PixelFormatDescriptorSize = (short)Marshal.SizeOf(typeof(PixelFormatDescriptor));
00091 WindowInfoSize = Marshal.SizeOf(typeof(WindowInfo));
00092 }
00093
00094 internal static readonly short PixelFormatDescriptorSize;
00095 internal static readonly short PixelFormatDescriptorVersion;
00096 internal static readonly int RawInputSize;
00097 internal static readonly int RawInputDeviceSize;
00098 internal static readonly int RawInputHeaderSize;
00099 internal static readonly int RawInputDeviceListSize;
00100 internal static readonly int RawInputDeviceInfoSize;
00101 internal static readonly int RawMouseSize;
00102 internal static readonly int WindowInfoSize;
00103 }
00104
00105 internal static class Functions
00106 {
00107 #region Window functions
00108
00109 #region SetWindowPos
00110
00111
00112
00113
00114 [DllImport("user32.dll")]
00115 [return: MarshalAs(UnmanagedType.Bool)]
00116 internal static extern bool SetWindowPos(
00117 IntPtr handle,
00118 IntPtr insertAfter,
00119 int x, int y, int cx, int cy,
00120 SetWindowPosFlags flags
00121 );
00122
00123 #endregion
00124
00125 #region AdjustWindowRect
00126
00143 [DllImport("user32.dll", SetLastError = true), SuppressUnmanagedCodeSecurity]
00144 internal static extern BOOL AdjustWindowRect([In, Out] ref Win32Rectangle lpRect, WindowStyle dwStyle, BOOL bMenu);
00145
00146 [DllImport("user32.dll", EntryPoint = "AdjustWindowRectEx", CallingConvention = CallingConvention.StdCall, SetLastError = true), SuppressUnmanagedCodeSecurity]
00147 internal static extern bool AdjustWindowRectEx(ref Win32Rectangle lpRect, WindowStyle dwStyle, bool bMenu, ExtendedWindowStyle dwExStyle);
00148
00149 #endregion
00150
00151 #region CreateWindowEx
00152
00153 [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]
00154 internal static extern IntPtr CreateWindowEx(
00155 ExtendedWindowStyle ExStyle,
00156 [MarshalAs(UnmanagedType.LPTStr)] string className,
00157 [MarshalAs(UnmanagedType.LPTStr)] string windowName,
00158 WindowStyle Style,
00159 int X, int Y,
00160 int Width, int Height,
00161 IntPtr HandleToParentWindow,
00162 IntPtr Menu,
00163 IntPtr Instance,
00164 IntPtr Param);
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179 [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]
00180 internal static extern IntPtr CreateWindowEx(
00181 ExtendedWindowStyle ExStyle,
00182 IntPtr ClassAtom,
00183 IntPtr WindowName,
00184 WindowStyle Style,
00185 int X, int Y,
00186 int Width, int Height,
00187 IntPtr HandleToParentWindow,
00188 IntPtr Menu,
00189 IntPtr Instance,
00190 IntPtr Param);
00191
00192 #region DestroyWindow
00193
00194 [DllImport("user32.dll", SetLastError = true)]
00195 [return: MarshalAs(UnmanagedType.Bool)]
00196 internal static extern bool DestroyWindow(IntPtr windowHandle);
00197
00198 #endregion
00199
00200 #region RegisterClass
00201
00202 [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]
00203 internal static extern ushort RegisterClass(ref WindowClass window_class);
00204
00205 #endregion
00206
00207 #region RegisterClassEx
00208
00209 [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]
00210 internal static extern ushort RegisterClassEx(ref ExtendedWindowClass window_class);
00211
00212 #endregion
00213
00214 #region UnregisterClass
00215
00216 [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]
00217 internal static extern short UnregisterClass([MarshalAs(UnmanagedType.LPTStr)] LPCTSTR className, IntPtr instance);
00218
00219 [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]
00220 internal static extern short UnregisterClass(IntPtr className, IntPtr instance);
00221
00222 #endregion
00223
00224 #region GetClassInfoEx
00225
00226 [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]
00227 internal static extern BOOL GetClassInfoEx(HINSTANCE hinst,
00228 [MarshalAs(UnmanagedType.LPTStr)] LPCTSTR lpszClass, ref ExtendedWindowClass lpwcx);
00229
00230 [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]
00231 internal static extern BOOL GetClassInfoEx(HINSTANCE hinst, UIntPtr lpszClass, ref ExtendedWindowClass lpwcx);
00232
00233 #endregion
00234
00235 #region CallWindowProc
00236
00237 #if RELEASE
00238 [SuppressUnmanagedCodeSecurity]
00239 #endif
00240 [DllImport("user32.dll", SetLastError = true)]
00241 internal static extern LRESULT CallWindowProc(WNDPROC lpPrevWndFunc, HWND hWnd, WindowMessage Msg,
00242 WPARAM wParam, LPARAM lParam);
00243
00244 #endregion
00245
00246 #region SetWindowLong
00247
00248
00249
00250
00251 internal static IntPtr SetWindowLong(IntPtr handle, GetWindowLongOffsets item, IntPtr newValue)
00252 {
00253
00254
00255
00256 IntPtr retval = IntPtr.Zero;
00257 SetLastError(0);
00258
00259 if (IntPtr.Size == 4)
00260 retval = new IntPtr(SetWindowLong(handle, item, newValue.ToInt32()));
00261 else
00262 retval = SetWindowLongPtr(handle, item, newValue);
00263
00264 if (retval == IntPtr.Zero)
00265 {
00266 int error = Marshal.GetLastWin32Error();
00267 if (error != 0)
00268 throw new PlatformException(String.Format("Failed to modify window border. Error: {0}", error));
00269 }
00270
00271 return retval;
00272 }
00273
00274 internal static IntPtr SetWindowLong(IntPtr handle, WindowProcedure newValue)
00275 {
00276 return SetWindowLong(handle, GetWindowLongOffsets.WNDPROC, Marshal.GetFunctionPointerForDelegate(newValue));
00277 }
00278
00279 #if RELASE
00280 [SuppressUnmanagedCodeSecurity]
00281 #endif
00282 [DllImport("user32.dll", SetLastError = true)]
00283 static extern LONG SetWindowLong(HWND hWnd, GetWindowLongOffsets nIndex, LONG dwNewLong);
00284
00285 #if RELASE
00286 [SuppressUnmanagedCodeSecurity]
00287 #endif
00288 [DllImport("user32.dll", SetLastError = true)]
00289 static extern LONG_PTR SetWindowLongPtr(HWND hWnd, GetWindowLongOffsets nIndex, LONG_PTR dwNewLong);
00290
00291 #if RELASE
00292 [SuppressUnmanagedCodeSecurity]
00293 #endif
00294 [DllImport("user32.dll", SetLastError = true)]
00295 static extern LONG SetWindowLong(HWND hWnd, GetWindowLongOffsets nIndex,
00296 [MarshalAs(UnmanagedType.FunctionPtr)]WindowProcedure dwNewLong);
00297
00298 #if RELASE
00299 [SuppressUnmanagedCodeSecurity]
00300 #endif
00301 [DllImport("user32.dll", SetLastError = true)]
00302 static extern LONG_PTR SetWindowLongPtr(HWND hWnd, GetWindowLongOffsets nIndex,
00303 [MarshalAs(UnmanagedType.FunctionPtr)]WindowProcedure dwNewLong);
00304
00305 #endregion
00306
00307 #region GetWindowLong
00308
00309 internal static UIntPtr GetWindowLong(IntPtr handle, GetWindowLongOffsets index)
00310 {
00311 if (IntPtr.Size == 4)
00312 return (UIntPtr)GetWindowLongInternal(handle, index);
00313
00314 return GetWindowLongPtrInternal(handle, index);
00315 }
00316
00317 [SuppressUnmanagedCodeSecurity]
00318 [DllImport("user32.dll", SetLastError = true, EntryPoint="GetWindowLong")]
00319 static extern ULONG GetWindowLongInternal(HWND hWnd, GetWindowLongOffsets nIndex);
00320
00321 [SuppressUnmanagedCodeSecurity]
00322 [DllImport("user32.dll", SetLastError = true, EntryPoint = "GetWindowLongPtr")]
00323 static extern UIntPtr GetWindowLongPtrInternal(HWND hWnd, GetWindowLongOffsets nIndex);
00324
00325 #endregion
00326
00327 #endregion
00328
00329 #region Message handling
00330
00331 #region PeekMessage
00332
00342 [System.Security.SuppressUnmanagedCodeSecurity]
00343 [DllImport("User32.dll"), CLSCompliant(false)]
00344 [return: MarshalAs(UnmanagedType.Bool)]
00345 internal static extern bool PeekMessage(ref MSG msg, IntPtr hWnd, int messageFilterMin, int messageFilterMax, int flags);
00346
00347 #endregion
00348
00349 #region GetMessage
00350
00364 [System.Security.SuppressUnmanagedCodeSecurity]
00365 [DllImport("User32.dll"), CLSCompliant(false)]
00366
00367 internal static extern INT GetMessage(ref MSG msg,
00368 IntPtr windowHandle, int messageFilterMin, int messageFilterMax);
00369
00370 #endregion
00371
00372 #region SendMessage
00373
00374 [DllImport("user32.dll", CharSet = CharSet.Auto)]
00375 internal static extern LRESULT SendMessage(HWND hWnd, WindowMessage Msg, WPARAM wParam, LPARAM lParam);
00376
00377 #endregion
00378
00379 #region PostMessage
00380
00381 [CLSCompliant(false)]
00382 [System.Security.SuppressUnmanagedCodeSecurity]
00383 [DllImport("User32.dll", CharSet = CharSet.Auto)]
00384 [return: MarshalAs(UnmanagedType.Bool)]
00385 internal static extern BOOL PostMessage(
00386 HWND hWnd,
00387 WindowMessage Msg,
00388 WPARAM wParam,
00389 LPARAM lParam
00390 );
00391
00392 #endregion
00393
00394 #region PostQuitMessage
00395
00396 [DllImport("User32.dll", CharSet = CharSet.Auto)]
00397 internal static extern void PostQuitMessage(int exitCode);
00398
00399 #endregion
00400
00401 #region DispatchMessage
00402
00403 #if RELEASE
00404 [System.Security.SuppressUnmanagedCodeSecurity]
00405 #endif
00406 [DllImport("User32.dll"), CLSCompliant(false)]
00407 internal static extern LRESULT DispatchMessage(ref MSG msg);
00408
00409 #endregion
00410
00411 #region TranslateMessage
00412
00413 #if RELEASE
00414 [System.Security.SuppressUnmanagedCodeSecurity]
00415 #endif
00416 [DllImport("User32.dll"), CLSCompliant(false)]
00417 internal static extern BOOL TranslateMessage(ref MSG lpMsg);
00418
00419 #endregion
00420
00421 #region GetQueueStatus
00422
00446 [System.Security.SuppressUnmanagedCodeSecurity]
00447 [DllImport("User32.dll", CharSet = CharSet.Auto)]
00448 internal static extern DWORD GetQueueStatus([MarshalAs(UnmanagedType.U4)] QueueStatusFlags flags);
00449
00450 #endregion
00451
00452 #region DefWindowProc
00453
00454 [DllImport("User32.dll", CharSet = CharSet.Auto)]
00455 public extern static IntPtr DefWindowProc(HWND hWnd, WindowMessage msg, IntPtr wParam, IntPtr lParam);
00456
00457 #endregion
00458
00459 #endregion
00460
00461 #region Timing
00462
00463 #region TimeBeginPeriod
00464
00470 [System.Security.SuppressUnmanagedCodeSecurity]
00471 [DllImport("winmm.dll")]
00472 internal static extern IntPtr TimeBeginPeriod(int period);
00473
00474 #endregion
00475
00476 #region QueryPerformanceFrequency
00477
00483 [System.Security.SuppressUnmanagedCodeSecurity]
00484 [DllImport("kernel32.dll")]
00485 [return: MarshalAs(UnmanagedType.Bool)]
00486 internal static extern bool QueryPerformanceFrequency(ref long PerformanceFrequency);
00487
00488 #endregion
00489
00490 #region QueryPerformanceCounter
00491
00497 [System.Security.SuppressUnmanagedCodeSecurity]
00498 [DllImport("kernel32.dll")]
00499 [return: MarshalAs(UnmanagedType.Bool)]
00500 internal static extern bool QueryPerformanceCounter(ref long PerformanceCount);
00501
00502 #endregion
00503
00504 #endregion
00505
00506 #region Rendering
00507
00508 #region GetDC
00509
00515 [DllImport("user32.dll")]
00516 internal static extern IntPtr GetDC(IntPtr hwnd);
00517
00518 #endregion
00519
00520 #region GetWindowDC
00521
00522 [DllImport("user32.dll")]
00523 internal static extern IntPtr GetWindowDC(IntPtr hwnd);
00524
00525 #endregion
00526
00527 #region ReleaseDC
00528
00535 [DllImport("user32.dll")]
00536 [return: MarshalAs(UnmanagedType.Bool)]
00537 internal static extern bool ReleaseDC(IntPtr hwnd, IntPtr DC);
00538
00539 #endregion
00540
00541 #region ChoosePixelFormat
00542
00543 [DllImport("gdi32.dll")]
00544 internal static extern int ChoosePixelFormat(IntPtr dc, ref PixelFormatDescriptor pfd);
00545
00546 #endregion
00547
00548 [DllImport("gdi32.dll")]
00549 internal static extern int DescribePixelFormat(IntPtr deviceContext, int pixel, int pfdSize, ref PixelFormatDescriptor pixelFormat);
00550
00551 #region SetPixelFormat
00552
00560 [DllImport("gdi32.dll", SetLastError=true)]
00561 [return: MarshalAs(UnmanagedType.Bool)]
00562 internal static extern bool SetPixelFormat(IntPtr dc, int format, ref PixelFormatDescriptor pfd);
00563
00564 #endregion
00565
00566 #region SwapBuffers
00567
00568 [SuppressUnmanagedCodeSecurity]
00569 [DllImport("gdi32.dll", SetLastError=true)]
00570 [return: MarshalAs(UnmanagedType.Bool)]
00571 internal static extern bool SwapBuffers(IntPtr dc);
00572
00573 #endregion
00574
00575 #region GetProcAddress
00576
00583 [DllImport("kernel32.dll")]
00584 internal static extern IntPtr GetProcAddress(IntPtr handle, string funcname);
00585
00586 #endregion
00587
00588 #endregion
00589
00590 #region DLL handling
00591
00592 #region SetLastError
00593
00594 [DllImport("kernel32.dll")]
00595 internal static extern void SetLastError(DWORD dwErrCode);
00596
00597 #endregion
00598
00599 #region GetModuleHandle
00600
00601 [DllImport("kernel32.dll")]
00602 internal static extern IntPtr GetModuleHandle([MarshalAs(UnmanagedType.LPTStr)]string module_name);
00603
00604 #endregion
00605
00606 #region LoadLibrary
00607
00613 [DllImport("kernel32.dll", SetLastError = true)]
00614 internal static extern IntPtr LoadLibrary(string dllName);
00615
00616 #endregion
00617
00618 #region FreeLibrary
00619
00625 [DllImport("kernel32.dll")]
00626 [return: MarshalAs(UnmanagedType.Bool)]
00627 internal static extern bool FreeLibrary(IntPtr handle);
00628
00629 #endregion
00630
00631 #endregion
00632
00633 #region GetAsyncKeyState
00634
00635 [System.Security.SuppressUnmanagedCodeSecurity]
00636 [DllImport("user32.dll", SetLastError = true)]
00637 internal static extern SHORT GetAsyncKeyState(VirtualKeys vKey);
00638
00639 #endregion
00640
00641 #region GetKeyState
00642
00643 [System.Security.SuppressUnmanagedCodeSecurity]
00644 [DllImport("user32.dll", SetLastError = true)]
00645 internal static extern SHORT GetKeyState(VirtualKeys vKey);
00646
00647 #endregion
00648
00649 #region MapVirtualKey
00650
00651 [System.Security.SuppressUnmanagedCodeSecurity]
00652 [DllImport("user32.dll", SetLastError = true)]
00653 internal static extern UINT MapVirtualKey(UINT uCode, MapVirtualKeyType uMapType);
00654
00655 [System.Security.SuppressUnmanagedCodeSecurity]
00656 [DllImport("user32.dll", SetLastError = true)]
00657 internal static extern UINT MapVirtualKey(VirtualKeys vkey, MapVirtualKeyType uMapType);
00658
00659 #endregion
00660
00661 #region ShowWindow
00662
00678 [DllImport("user32.dll", SetLastError = true), SuppressUnmanagedCodeSecurity]
00679 internal static extern BOOL ShowWindow(HWND hWnd, ShowWindowCommand nCmdShow);
00680
00681 #endregion
00682
00683 #region SetWindowText
00684
00700 [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]
00701 internal static extern BOOL SetWindowText(HWND hWnd, [MarshalAs(UnmanagedType.LPTStr)] string lpString);
00702
00703 #endregion
00704
00705 #region GetWindowText
00706
00722 [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]
00723 internal static extern int GetWindowText(HWND hWnd, [MarshalAs(UnmanagedType.LPTStr), In, Out] StringBuilder lpString, int nMaxCount);
00724
00725 #endregion
00726
00727 #region ScreenToClient
00728
00741 [DllImport("user32.dll", SetLastError = true), SuppressUnmanagedCodeSecurity]
00742
00743 internal static extern BOOL ScreenToClient(HWND hWnd, ref Point point);
00744
00745 #endregion
00746
00747 #region ClientToScreen
00748
00759 [DllImport("user32.dll", SetLastError = true), SuppressUnmanagedCodeSecurity]
00760 internal static extern BOOL ClientToScreen(HWND hWnd, ref Point point);
00761
00762 #endregion
00763
00764 #region GetClientRect
00765
00776 [DllImport("user32.dll", SetLastError = true), SuppressUnmanagedCodeSecurity]
00777 internal extern static BOOL GetClientRect(HWND windowHandle, out Win32Rectangle clientRectangle);
00778
00779 #endregion
00780
00781 #region GetWindowRect
00782
00793 [DllImport("user32.dll", SetLastError = true), SuppressUnmanagedCodeSecurity]
00794 internal extern static BOOL GetWindowRect(HWND windowHandle, out Win32Rectangle windowRectangle);
00795
00796 #endregion
00797
00798 #region GetWindowInfo
00799
00800 [DllImport("user32.dll"), SuppressUnmanagedCodeSecurity]
00801 internal static extern BOOL GetWindowInfo(HWND hwnd, ref WindowInfo wi);
00802
00803 #endregion
00804
00805 #region DwmGetWindowAttribute
00806
00807 [DllImport("dwmapi.dll")]
00808 unsafe public static extern HRESULT DwmGetWindowAttribute(HWND hwnd, DwmWindowAttribute dwAttribute, void* pvAttribute, DWORD cbAttribute);
00809
00810 #endregion
00811
00812 #region GetFocus
00813
00814 [DllImport("user32.dll")]
00815 public static extern HWND GetFocus();
00816
00817 #endregion
00818
00819 #region IsWindowVisible
00820
00821 [DllImport("user32.dll")]
00822 public static extern bool IsWindowVisible(IntPtr intPtr);
00823
00824 #endregion
00825
00826 #region LoadIcon
00827
00828 [DllImport("user32.dll")]
00829 public static extern HICON LoadIcon(HINSTANCE hInstance, LPCTSTR lpIconName);
00830
00831 #endregion
00832
00833 #region LoadCursor
00834
00835 [DllImport("user32.dll")]
00836 public static extern HCURSOR LoadCursor(HINSTANCE hInstance, LPCTSTR lpCursorName);
00837
00838 [DllImport("user32.dll")]
00839 public static extern HCURSOR LoadCursor(HINSTANCE hInstance, IntPtr lpCursorName);
00840
00841 public static HCURSOR LoadCursor(CursorName lpCursorName)
00842 {
00843 return LoadCursor(IntPtr.Zero, new IntPtr((int)lpCursorName));
00844 }
00845
00846 #endregion
00847
00848 [DllImport("user32.dll", SetLastError=true)]
00849 public static extern BOOL SetForegroundWindow(HWND hWnd);
00850
00851 [DllImport("user32.dll", SetLastError = true)]
00852 public static extern BOOL BringWindowToTop(HWND hWnd);
00853
00854 #endregion
00855
00856 #region Display settings
00857
00858 #region ChangeDisplaySettings
00859
00870 [DllImport("user32.dll", SetLastError = true)]
00871 internal static extern int ChangeDisplaySettings(DeviceMode device_mode, ChangeDisplaySettingsEnum flags);
00872
00873 #endregion int ChangeDisplaySettings
00874
00875 #region ChangeDisplaySettingsEx
00876
00877 [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]
00878 public static extern LONG ChangeDisplaySettingsEx([MarshalAs(UnmanagedType.LPTStr)] LPCTSTR lpszDeviceName,
00879 LPDEVMODE lpDevMode, HWND hwnd, ChangeDisplaySettingsEnum dwflags, LPVOID lParam);
00880
00881 #endregion
00882
00883 #region EnumDisplayDevices
00884
00885 [DllImport("user32.dll", SetLastError = true, CharSet=CharSet.Auto)]
00886 [return: MarshalAs(UnmanagedType.Bool)]
00887 public static extern BOOL EnumDisplayDevices([MarshalAs(UnmanagedType.LPTStr)] LPCTSTR lpDevice,
00888 DWORD iDevNum, [In, Out] WindowsDisplayDevice lpDisplayDevice, DWORD dwFlags);
00889
00890 #endregion
00891
00892 #region EnumDisplaySettings
00893
00894 [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]
00895 [return: MarshalAs(UnmanagedType.Bool)]
00896 internal static extern BOOL EnumDisplaySettings([MarshalAs(UnmanagedType.LPTStr)] string device_name,
00897 int graphics_mode, [In, Out] DeviceMode device_mode);
00898
00899 [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]
00900 [return: MarshalAs(UnmanagedType.Bool)]
00901 internal static extern BOOL EnumDisplaySettings([MarshalAs(UnmanagedType.LPTStr)] string device_name,
00902 DisplayModeSettingsEnum graphics_mode, [In, Out] DeviceMode device_mode);
00903
00904 #endregion
00905
00906 #region EnumDisplaySettingsEx
00907
00908 [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]
00909 public static extern BOOL EnumDisplaySettingsEx([MarshalAs(UnmanagedType.LPTStr)] LPCTSTR lpszDeviceName, DisplayModeSettingsEnum iModeNum,
00910 [In, Out] DeviceMode lpDevMode, DWORD dwFlags);
00911
00912 #endregion
00913
00914 #region GetMonitorInfo
00915
00916 [DllImport("user32.dll", SetLastError = true)]
00917 public static extern BOOL GetMonitorInfo(IntPtr hMonitor, ref MonitorInfo lpmi);
00918
00919 #endregion
00920
00921 #region MonitorFromPoint
00922
00923 [DllImport("user32.dll", SetLastError = true)]
00924 public static extern HMONITOR MonitorFromPoint(POINT pt, MonitorFrom dwFlags);
00925
00926 #endregion
00927
00928 #region MonitorFromWindow
00929
00930 [DllImport("user32.dll", SetLastError = true)]
00931 public static extern HMONITOR MonitorFromWindow(HWND hwnd, MonitorFrom dwFlags);
00932
00933 #endregion
00934
00935 #endregion
00936
00937 #region Input functions
00938
00939 [DllImport("user32.dll", SetLastError=true)]
00940 public static extern BOOL TrackMouseEvent(ref TrackMouseEventStructure lpEventTrack);
00941
00942 [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true, ExactSpelling = true)]
00943 public static extern bool ReleaseCapture();
00944
00945 [DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true)]
00946 public static extern IntPtr SetCapture(IntPtr hwnd);
00947
00948 [DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true)]
00949 public static extern IntPtr GetCapture();
00950
00951 [DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true)]
00952 public static extern IntPtr SetFocus(IntPtr hwnd);
00953
00954 #region Async input
00955
00956 #region GetCursorPos
00957
00968 [DllImport("user32.dll", SetLastError = true), SuppressUnmanagedCodeSecurity]
00969 internal static extern BOOL GetCursorPos(ref Point point);
00970
00971 #endregion
00972
00973 #endregion
00974
00975 #region Raw Input
00976
00977 #region DefRawInputProc
00978
00989 [CLSCompliant(false)]
00990 [System.Security.SuppressUnmanagedCodeSecurity]
00991 [DllImport("user32.dll", SetLastError = true)]
00992 internal static extern LRESULT DefRawInputProc(RawInput[] RawInput, INT Input, UINT SizeHeader);
00993
00994 [CLSCompliant(false)]
00995 [System.Security.SuppressUnmanagedCodeSecurity]
00996 [DllImport("user32.dll", SetLastError = true)]
00997 unsafe internal static extern LRESULT DefRawInputProc(ref RawInput RawInput, INT Input, UINT SizeHeader);
00998
00999 [CLSCompliant(false)]
01000 [System.Security.SuppressUnmanagedCodeSecurity]
01001 [DllImport("user32.dll", SetLastError = true)]
01002 unsafe internal static extern LRESULT DefRawInputProc(IntPtr RawInput, INT Input, UINT SizeHeader);
01003
01004 #endregion
01005
01006 #region RegisterRawInputDevices
01007
01023 [CLSCompliant(false)]
01024 [DllImport("user32.dll", SetLastError = true)]
01025 [return: MarshalAs(UnmanagedType.Bool)]
01026 internal static extern BOOL RegisterRawInputDevices(
01027 RawInputDevice[] RawInputDevices,
01028 UINT NumDevices,
01029 UINT Size
01030 );
01031
01032 [DllImport("user32.dll", SetLastError = true)]
01033 [return: MarshalAs(UnmanagedType.Bool)]
01034 internal static extern BOOL RegisterRawInputDevices(
01035 RawInputDevice[] RawInputDevices,
01036 INT NumDevices,
01037 INT Size
01038 );
01039
01040 #endregion
01041
01042 #region GetRawInputBuffer
01043
01059 [CLSCompliant(false)]
01060 [System.Security.SuppressUnmanagedCodeSecurity]
01061 [DllImport("user32.dll", SetLastError = true)]
01062 internal static extern UINT GetRawInputBuffer(
01063 [Out] RawInput[] Data,
01064 [In, Out] ref UINT Size,
01065 [In] UINT SizeHeader
01066 );
01067
01068 [System.Security.SuppressUnmanagedCodeSecurity]
01069 [DllImport("user32.dll", SetLastError = true)]
01070 internal static extern INT GetRawInputBuffer(
01071 [Out] RawInput[] Data,
01072 [In, Out] ref INT Size,
01073 [In] INT SizeHeader
01074 );
01075
01076 [System.Security.SuppressUnmanagedCodeSecurity]
01077 [DllImport("user32.dll", SetLastError = true)]
01078 internal static extern INT GetRawInputBuffer(
01079 [Out] IntPtr Data,
01080 [In, Out] ref INT Size,
01081 [In] INT SizeHeader
01082 );
01083
01084 #endregion
01085
01086 #region GetRegisteredRawInputDevices
01087
01114 [CLSCompliant(false)]
01115 [DllImport("user32.dll", SetLastError = true)]
01116 internal static extern UINT GetRegisteredRawInputDevices(
01117 [Out] RawInput[] RawInputDevices,
01118 [In, Out] ref UINT NumDevices,
01119 UINT cbSize
01120 );
01121
01122 [DllImport("user32.dll", SetLastError = true)]
01123 internal static extern INT GetRegisteredRawInputDevices(
01124 [Out] RawInput[] RawInputDevices,
01125 [In, Out] ref INT NumDevices,
01126 INT cbSize
01127 );
01128
01129 #endregion
01130
01131 #region GetRawInputDeviceList
01132
01160 [CLSCompliant(false)]
01161 [DllImport("user32.dll", SetLastError = true)]
01162 internal static extern UINT GetRawInputDeviceList(
01163 [In, Out] RawInputDeviceList[] RawInputDeviceList,
01164 [In, Out] ref UINT NumDevices,
01165 UINT Size
01166 );
01167
01168 [DllImport("user32.dll", SetLastError = true)]
01169 internal static extern INT GetRawInputDeviceList(
01170 [In, Out] RawInputDeviceList[] RawInputDeviceList,
01171 [In, Out] ref INT NumDevices,
01172 INT Size
01173 );
01174
01202 [CLSCompliant(false)]
01203 [DllImport("user32.dll", SetLastError = true)]
01204 internal static extern UINT GetRawInputDeviceList(
01205 [In, Out] IntPtr RawInputDeviceList,
01206 [In, Out] ref UINT NumDevices,
01207 UINT Size
01208 );
01209
01210 [DllImport("user32.dll", SetLastError = true)]
01211 internal static extern INT GetRawInputDeviceList(
01212 [In, Out] IntPtr RawInputDeviceList,
01213 [In, Out] ref INT NumDevices,
01214 INT Size
01215 );
01216
01217 #endregion
01218
01219 #region GetRawInputDeviceInfo
01220
01252 [CLSCompliant(false)]
01253 [System.Security.SuppressUnmanagedCodeSecurity]
01254 [DllImport("user32.dll", SetLastError = true)]
01255 internal static extern UINT GetRawInputDeviceInfo(
01256 HANDLE Device,
01257 [MarshalAs(UnmanagedType.U4)] RawInputDeviceInfoEnum Command,
01258 [In, Out] LPVOID Data,
01259 [In, Out] ref UINT Size
01260 );
01261
01262 [System.Security.SuppressUnmanagedCodeSecurity]
01263 [DllImport("user32.dll", SetLastError = true)]
01264 internal static extern INT GetRawInputDeviceInfo(
01265 HANDLE Device,
01266 [MarshalAs(UnmanagedType.U4)] RawInputDeviceInfoEnum Command,
01267 [In, Out] LPVOID Data,
01268 [In, Out] ref INT Size
01269 );
01270
01302 [CLSCompliant(false)]
01303 [System.Security.SuppressUnmanagedCodeSecurity]
01304 [DllImport("user32.dll", SetLastError = true)]
01305 internal static extern UINT GetRawInputDeviceInfo(
01306 HANDLE Device,
01307 [MarshalAs(UnmanagedType.U4)] RawInputDeviceInfoEnum Command,
01308 [In, Out] RawInputDeviceInfo Data,
01309 [In, Out] ref UINT Size
01310 );
01311
01312 [System.Security.SuppressUnmanagedCodeSecurity]
01313 [DllImport("user32.dll", SetLastError = true)]
01314 internal static extern INT GetRawInputDeviceInfo(
01315 HANDLE Device,
01316 [MarshalAs(UnmanagedType.U4)] RawInputDeviceInfoEnum Command,
01317 [In, Out] RawInputDeviceInfo Data,
01318 [In, Out] ref INT Size
01319 );
01320
01321
01322 #endregion
01323
01324 #region GetRawInputData
01325
01347 [CLSCompliant(false)]
01348 [System.Security.SuppressUnmanagedCodeSecurity]
01349 [DllImport("user32.dll", SetLastError = true)]
01350 internal static extern UINT GetRawInputData(
01351 HRAWINPUT RawInput,
01352 GetRawInputDataEnum Command,
01353 [Out] LPVOID Data,
01354 [In, Out] ref UINT Size,
01355 UINT SizeHeader
01356 );
01357
01358 [System.Security.SuppressUnmanagedCodeSecurity]
01359 [DllImport("user32.dll", SetLastError = true)]
01360 internal static extern INT GetRawInputData(
01361 HRAWINPUT RawInput,
01362 GetRawInputDataEnum Command,
01363 [Out] LPVOID Data,
01364 [In, Out] ref INT Size,
01365 INT SizeHeader
01366 );
01367
01389 [CLSCompliant(false)]
01390 [System.Security.SuppressUnmanagedCodeSecurity]
01391 [DllImport("user32.dll", SetLastError = true)]
01392 internal static extern UINT GetRawInputData(
01393 HRAWINPUT RawInput,
01394 GetRawInputDataEnum Command,
01395 [Out] out RawInput Data,
01396 [In, Out] ref UINT Size,
01397 UINT SizeHeader
01398 );
01399
01400 [System.Security.SuppressUnmanagedCodeSecurity]
01401 [DllImport("user32.dll", SetLastError = true)]
01402 internal static extern INT GetRawInputData(
01403 HRAWINPUT RawInput,
01404 GetRawInputDataEnum Command,
01405 [Out] out RawInput Data,
01406 [In, Out] ref INT Size,
01407 INT SizeHeader
01408 );
01409
01410 #endregion
01411
01412 #region IntPtr NextRawInputStructure(IntPtr data)
01413
01414
01415
01416
01417
01418
01419
01420
01421
01422
01423
01424 internal static IntPtr NextRawInputStructure(IntPtr data)
01425 {
01426 unsafe
01427 {
01428 return RawInputAlign((IntPtr)(((byte*)data) + API.RawInputHeaderSize));
01429 }
01430 }
01431
01432 private static IntPtr RawInputAlign(IntPtr data)
01433 {
01434 unsafe
01435 {
01436 return (IntPtr)(((byte*)data) + ((IntPtr.Size - 1) & ~(IntPtr.Size - 1)));
01437 }
01438 }
01439
01440
01441 #endregion
01442
01443 #endregion
01444
01445 #endregion
01446
01447 #region GDI functions
01448
01449 #region GetStockObject
01450
01451 [DllImport("gdi32.dll", SetLastError = true)]
01452 internal static extern IntPtr GetStockObject(int index);
01453
01454 #endregion
01455
01456 #endregion
01457
01458 #region Timer Functions
01459
01460 [DllImport("user32.dll", SetLastError=true)]
01461 public static extern UINT_PTR SetTimer(HWND hWnd, UINT_PTR nIDEvent, UINT uElapse, TIMERPROC lpTimerFunc);
01462
01463 [DllImport("user32.dll", SetLastError=true)]
01464 public static extern BOOL KillTimer(HWND hWnd, UINT_PTR uIDEvent);
01465
01466 [UnmanagedFunctionPointer(CallingConvention.Winapi)]
01467 public delegate void TimerProc(HWND hwnd, WindowMessage uMsg, UINT_PTR idEvent, DWORD dwTime);
01468
01469 #endregion
01470
01471 #region Shell Functions
01472
01473 [DllImport("shell32.dll")]
01474 public static extern DWORD_PTR SHGetFileInfo(LPCTSTR pszPath, DWORD dwFileAttributes, ref SHFILEINFO psfi, UINT cbFileInfo, ShGetFileIconFlags uFlags);
01475
01476 #endregion
01477 }
01478
01479 #region --- Constants ---
01480
01481 internal struct Constants
01482 {
01483
01484 internal const int KEYBOARD_OVERRUN_MAKE_CODE = 0xFF;
01485
01486
01487 internal const int WA_INACTIVE = 0;
01488 internal const int WA_ACTIVE = 1;
01489 internal const int WA_CLICKACTIVE = 2;
01490
01491
01492 internal const int WM_NULL = 0x0000;
01493 internal const int WM_CREATE = 0x0001;
01494 internal const int WM_DESTROY = 0x0002;
01495 internal const int WM_MOVE = 0x0003;
01496 internal const int WM_SIZE = 0x0005;
01497 internal const int WM_ACTIVATE = 0x0006;
01498 internal const int WM_SETFOCUS = 0x0007;
01499 internal const int WM_KILLFOCUS = 0x0008;
01500 internal const int WM_ENABLE = 0x000A;
01501 internal const int WM_SETREDRAW = 0x000B;
01502 internal const int WM_SETTEXT = 0x000C;
01503 internal const int WM_GETTEXT = 0x000D;
01504 internal const int WM_GETTEXTLENGTH = 0x000E;
01505 internal const int WM_PAINT = 0x000F;
01506 internal const int WM_CLOSE = 0x0010;
01507
01508 internal const int WM_QUERYENDSESSION = 0x0011;
01509 internal const int WM_QUERYOPEN = 0x0013;
01510 internal const int WM_ENDSESSION = 0x0016;
01511 internal const int WM_QUIT = 0x0012;
01512 internal const int WM_ERASEBKGND = 0x0014;
01513 internal const int WM_SYSCOLORCHANGE = 0x0015;
01514 internal const int WM_SHOWWINDOW = 0x0018;
01515 internal const int WM_WININICHANGE = 0x001A;
01516
01517 internal const int WM_SETTINGCHANGE = WM_WININICHANGE;
01518
01519 internal const int WM_DEVMODECHANGE = 0x001B;
01520 internal const int WM_ACTIVATEAPP = 0x001C;
01521 internal const int WM_FONTCHANGE = 0x001D;
01522 internal const int WM_TIMECHANGE = 0x001E;
01523 internal const int WM_CANCELMODE = 0x001F;
01524 internal const int WM_SETCURSOR = 0x0020;
01525 internal const int WM_MOUSEACTIVATE = 0x0021;
01526 internal const int WM_CHILDACTIVATE = 0x0022;
01527 internal const int WM_QUEUESYNC = 0x0023;
01528
01529 internal const int WM_GETMINMAXINFO = 0x0024;
01530
01531 internal const int WM_WINDOWPOSCHANGING = 0x0046;
01532 internal const int WM_WINDOWPOSCHANGED = 0x0047;
01533
01534
01535 internal const int WM_INPUT = 0x00FF;
01536 internal const int WM_KEYDOWN = 0x0100;
01537 internal const int WM_KEYUP = 0x101;
01538 internal const int WM_SYSKEYDOWN = 0x0104;
01539 internal const int WM_SYSKEYUP = 0x0105;
01540 internal const int WM_COMMAND = 0x0111;
01541 internal const int WM_SYSCOMMAND = 0x0112;
01542 internal const int WM_ENTERIDLE = 0x121;
01543
01544
01545 internal const byte PFD_TYPE_RGBA = 0;
01546 internal const byte PFD_TYPE_COLORINDEX = 1;
01547
01548
01549 internal const byte PFD_MAIN_PLANE = 0;
01550 internal const byte PFD_OVERLAY_PLANE = 1;
01551 internal const byte PFD_UNDERLAY_PLANE = unchecked((byte)-1);
01552
01553
01554 internal const int DM_BITSPERPEL = 0x00040000;
01555 internal const int DM_PELSWIDTH = 0x00080000;
01556 internal const int DM_PELSHEIGHT = 0x00100000;
01557 internal const int DM_DISPLAYFLAGS = 0x00200000;
01558 internal const int DM_DISPLAYFREQUENCY = 0x00400000;
01559
01560
01561 internal const int DISP_CHANGE_SUCCESSFUL = 0;
01562 internal const int DISP_CHANGE_RESTART = 1;
01563 internal const int DISP_CHANGE_FAILED = -1;
01564
01565
01566 internal const int ENUM_REGISTRY_SETTINGS = -2;
01567 internal const int ENUM_CURRENT_SETTINGS = -1;
01568 }
01569
01570 #endregion
01571
01572 #region --- Structures ---
01573
01574 #region CreateStruct
01575
01576 internal struct CreateStruct
01577 {
01602 internal LPVOID lpCreateParams;
01606 internal HINSTANCE hInstance;
01610 internal HMENU hMenu;
01616 internal HWND hwndParent;
01620 internal int cy;
01624 internal int cx;
01630 internal int y;
01636 internal int x;
01640 internal LONG style;
01644 [MarshalAs(UnmanagedType.LPTStr)]
01645 internal LPCTSTR lpszName;
01654 [MarshalAs(UnmanagedType.LPTStr)]
01655 internal LPCTSTR lpszClass;
01659 internal DWORD dwExStyle;
01660 }
01661
01662 #endregion
01663
01664 #region StyleStruct
01665
01666 struct StyleStruct
01667 {
01668 public WindowStyle Old;
01669 public WindowStyle New;
01670 }
01671
01672 #endregion
01673
01674 #region ExtendedStyleStruct
01675
01676 struct ExtendedStyleStruct
01677 {
01678 public ExtendedWindowStyle Old;
01679 public ExtendedWindowStyle New;
01680 }
01681
01682 #endregion
01683
01684 #region PixelFormatDescriptor
01685
01691 [StructLayout(LayoutKind.Sequential)]
01692 internal struct PixelFormatDescriptor
01693 {
01694 internal short Size;
01695 internal short Version;
01696 internal PixelFormatDescriptorFlags Flags;
01697 internal PixelType PixelType;
01698 internal byte ColorBits;
01699 internal byte RedBits;
01700 internal byte RedShift;
01701 internal byte GreenBits;
01702 internal byte GreenShift;
01703 internal byte BlueBits;
01704 internal byte BlueShift;
01705 internal byte AlphaBits;
01706 internal byte AlphaShift;
01707 internal byte AccumBits;
01708 internal byte AccumRedBits;
01709 internal byte AccumGreenBits;
01710 internal byte AccumBlueBits;
01711 internal byte AccumAlphaBits;
01712 internal byte DepthBits;
01713 internal byte StencilBits;
01714 internal byte AuxBuffers;
01715 internal byte LayerType;
01716 private byte Reserved;
01717 internal int LayerMask;
01718 internal int VisibleMask;
01719 internal int DamageMask;
01720 }
01721
01722 #endregion
01723
01724 #region internal class LayerPlaneDescriptor
01725
01730 [StructLayout(LayoutKind.Sequential)]
01731 internal struct LayerPlaneDescriptor
01732 {
01733 internal static readonly WORD Size = (WORD)Marshal.SizeOf(typeof(LayerPlaneDescriptor));
01734 internal WORD Version;
01735 internal DWORD Flags;
01736 internal BYTE PixelType;
01737 internal BYTE ColorBits;
01738 internal BYTE RedBits;
01739 internal BYTE RedShift;
01740 internal BYTE GreenBits;
01741 internal BYTE GreenShift;
01742 internal BYTE BlueBits;
01743 internal BYTE BlueShift;
01744 internal BYTE AlphaBits;
01745 internal BYTE AlphaShift;
01746 internal BYTE AccumBits;
01747 internal BYTE AccumRedBits;
01748 internal BYTE AccumGreenBits;
01749 internal BYTE AccumBlueBits;
01750 internal BYTE AccumAlphaBits;
01751 internal BYTE DepthBits;
01752 internal BYTE StencilBits;
01753 internal BYTE AuxBuffers;
01754 internal BYTE LayerPlane;
01755 BYTE Reserved;
01756 internal COLORREF crTransparent;
01757 }
01758
01759 #endregion
01760
01761 #region GlyphMetricsFloat
01762
01770 [StructLayout(LayoutKind.Sequential)]
01771 internal struct GlyphMetricsFloat
01772 {
01776 internal float BlackBoxX;
01780 internal float BlackBoxY;
01784 internal PointFloat GlyphOrigin;
01788 internal float CellIncX;
01792 internal float CellIncY;
01793 }
01794
01795 #endregion
01796
01797 #region PointFloat
01798
01804 [StructLayout(LayoutKind.Sequential)]
01805 internal struct PointFloat
01806 {
01810 internal float X;
01814 internal float Y;
01815 };
01816
01817 #endregion
01818
01819 #region DeviceMode
01820
01821
01822
01823
01824
01825
01826
01827
01828
01829
01830
01831
01832
01833
01834
01835
01836
01837
01838
01839
01840
01841
01842
01843
01844
01845
01846
01847
01848
01849
01850
01851
01852
01853
01854
01855
01856
01857
01858
01859
01860
01861
01862
01863
01864
01865
01866
01867
01868
01869
01870
01871
01872
01873 [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
01874 internal class DeviceMode
01875 {
01876 internal DeviceMode()
01877 {
01878 Size = (short)Marshal.SizeOf(this);
01879 }
01880
01881 [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)]
01882 internal string DeviceName;
01883 internal short SpecVersion;
01884 internal short DriverVersion;
01885 private short Size;
01886 internal short DriverExtra;
01887 internal int Fields;
01888
01889
01890
01891
01892
01893
01894
01895
01896
01897
01898 internal POINT Position;
01899 internal DWORD DisplayOrientation;
01900 internal DWORD DisplayFixedOutput;
01901
01902 internal short Color;
01903 internal short Duplex;
01904 internal short YResolution;
01905 internal short TTOption;
01906 internal short Collate;
01907 [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)]
01908 internal string FormName;
01909 internal short LogPixels;
01910 internal int BitsPerPel;
01911 internal int PelsWidth;
01912 internal int PelsHeight;
01913 internal int DisplayFlags;
01914 internal int DisplayFrequency;
01915 internal int ICMMethod;
01916 internal int ICMIntent;
01917 internal int MediaType;
01918 internal int DitherType;
01919 internal int Reserved1;
01920 internal int Reserved2;
01921 internal int PanningWidth;
01922 internal int PanningHeight;
01923 }
01924
01925 #endregion DeviceMode class
01926
01927 #region DisplayDevice
01928
01932 [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
01933 internal class WindowsDisplayDevice
01934 {
01935 internal WindowsDisplayDevice()
01936 {
01937 size = (short)Marshal.SizeOf(this);
01938 }
01939 readonly DWORD size;
01940 [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)]
01941 internal string DeviceName;
01942 [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)]
01943 internal string DeviceString;
01944 internal DisplayDeviceStateFlags StateFlags;
01945 [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)]
01946 internal string DeviceID;
01947 [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)]
01948 internal string DeviceKey;
01949 }
01950
01951 #endregion
01952
01953 #region Window Handling
01954
01955 #region WindowClass
01956 [StructLayout(LayoutKind.Sequential)]
01957 internal struct WindowClass
01958 {
01959 internal ClassStyle Style;
01960 [MarshalAs(UnmanagedType.FunctionPtr)]
01961 internal WindowProcedure WindowProcedure;
01962 internal int ClassExtraBytes;
01963 internal int WindowExtraBytes;
01964
01965 internal IntPtr Instance;
01966 internal IntPtr Icon;
01967 internal IntPtr Cursor;
01968 internal IntPtr BackgroundBrush;
01969
01970 internal IntPtr MenuName;
01971 [MarshalAs(UnmanagedType.LPTStr)]
01972 internal string ClassName;
01973
01974
01975 internal static int SizeInBytes = Marshal.SizeOf(default(WindowClass));
01976 }
01977 #endregion
01978
01979 #region ExtendedWindowClass
01980
01981 [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
01982 struct ExtendedWindowClass
01983 {
01984 public UINT Size;
01985 public ClassStyle Style;
01986
01987 [MarshalAs(UnmanagedType.FunctionPtr)]
01988 public WindowProcedure WndProc;
01989 public int cbClsExtra;
01990 public int cbWndExtra;
01991 public HINSTANCE Instance;
01992 public HICON Icon;
01993 public HCURSOR Cursor;
01994 public HBRUSH Background;
01995 public IntPtr MenuName;
01996 public IntPtr ClassName;
01997 public HICON IconSm;
01998
01999 public static uint SizeInBytes = (uint)Marshal.SizeOf(default(ExtendedWindowClass));
02000 }
02001
02002 #endregion
02003
02004 #region internal struct MinMaxInfo
02005
02010 [StructLayout(LayoutKind.Sequential)]
02011 internal struct MINMAXINFO
02012 {
02013 Point Reserved;
02014 public Size MaxSize;
02015 public Point MaxPosition;
02016 public Size MinTrackSize;
02017 public Size MaxTrackSize;
02018 }
02019
02020 #endregion
02021
02022 #region internal struct WindowPosition
02023
02028 [StructLayout(LayoutKind.Sequential)]
02029 internal struct WindowPosition
02030 {
02034 internal HWND hwnd;
02040 internal HWND hwndInsertAfter;
02044 internal int x;
02048 internal int y;
02052 internal int cx;
02056 internal int cy;
02060 [MarshalAs(UnmanagedType.U4)]
02061 internal SetWindowPosFlags flags;
02062 }
02063
02064 #region internal enum SetWindowPosFlags
02065
02066 [Flags]
02067 internal enum SetWindowPosFlags : int
02068 {
02072 NOSIZE = 0x0001,
02076 NOMOVE = 0x0002,
02080 NOZORDER = 0x0004,
02088 NOREDRAW = 0x0008,
02094 NOACTIVATE = 0x0010,
02099 FRAMECHANGED = 0x0020,
02103 SHOWWINDOW = 0x0040,
02107 HIDEWINDOW = 0x0080,
02113 NOCOPYBITS = 0x0100,
02117 NOOWNERZORDER = 0x0200,
02121 NOSENDCHANGING = 0x0400,
02122
02126 DRAWFRAME = FRAMECHANGED,
02130 NOREPOSITION = NOOWNERZORDER,
02131
02132 DEFERERASE = 0x2000,
02133 ASYNCWINDOWPOS = 0x4000
02134 }
02135
02136 #endregion
02137
02138 #endregion
02139
02140 #endregion
02141
02142 #region Raw Input structures
02143
02144 #region RawInputDevice
02145
02152 [StructLayout(LayoutKind.Sequential)]
02153 internal struct RawInputDevice
02154 {
02158
02159 internal SHORT UsagePage;
02163
02164 internal SHORT Usage;
02171 internal RawInputDeviceFlags Flags;
02175 internal HWND Target;
02176
02177 public override string ToString()
02178 {
02179 return String.Format("{0}/{1}, flags: {2}, window: {3}", UsagePage, Usage, Flags, Target);
02180 }
02181 }
02182
02183 #endregion
02184
02185 #region RawInputDeviceList
02186
02190 [StructLayout(LayoutKind.Sequential)]
02191 internal struct RawInputDeviceList
02192 {
02196 internal HANDLE Device;
02200 internal RawInputDeviceType Type;
02201
02202 public override string ToString()
02203 {
02204 return String.Format("{0}, Handle: {1}", Type, Device);
02205 }
02206 }
02207
02208 #endregion
02209
02210 #region RawInput
02211
02221 [StructLayout(LayoutKind.Sequential)]
02222 internal struct RawInput
02223 {
02224 internal RawInputHeader Header;
02225 internal RawInputData Data;
02226
02227 internal byte[] ToByteArray()
02228 {
02229 unsafe
02230 {
02231 byte[] dump = new byte[API.RawInputSize];
02232 fixed (RawInputDeviceType* ptr = &Header.Type)
02233 {
02234 for (int i = 0; i < API.RawInputSize; i++)
02235 dump[i] = *((byte*)ptr + i);
02236 return dump;
02237 }
02238 }
02239 }
02240 }
02241
02242 [StructLayout(LayoutKind.Explicit)]
02243 internal struct RawInputData
02244 {
02245 [FieldOffset(0)]
02246 internal RawMouse Mouse;
02247 [FieldOffset(0)]
02248 internal RawKeyboard Keyboard;
02249 [FieldOffset(0)]
02250 internal RawHID HID;
02251 }
02252
02253 #endregion
02254
02255 #region RawInputHeader
02256
02264 [StructLayout(LayoutKind.Sequential)]
02265 internal struct RawInputHeader
02266 {
02270 internal RawInputDeviceType Type;
02274 internal DWORD Size;
02278 internal HANDLE Device;
02282 internal WPARAM Param;
02283 }
02284
02285 #endregion
02286
02287 #region RawKeyboard
02288
02293 [StructLayout(LayoutKind.Sequential)]
02294 internal struct RawKeyboard
02295 {
02299
02300 internal SHORT MakeCode;
02310 internal RawInputKeyboardDataFlags Flags;
02314 USHORT Reserved;
02318
02319 internal VirtualKeys VKey;
02323
02324 internal INT Message;
02328
02329 internal LONG ExtraInformation;
02330 }
02331
02332 #endregion
02333
02334 #region RawMouse
02335
02340 [StructLayout(LayoutKind.Sequential, Pack=1)]
02341 internal struct RawMouse
02342 {
02343
02344 USHORT flags;
02345 byte for_alignment;
02349
02350 internal USHORT buttonFlags;
02354 internal USHORT ButtonData;
02358 internal ULONG RawButtons;
02362 internal LONG LastX;
02366 internal LONG LastY;
02370 internal ULONG ExtraInformation;
02371
02383 internal RawMouseFlags Flags { get { return (RawMouseFlags)(flags); } }
02384
02388 internal RawInputMouseState ButtonFlags { get { return (RawInputMouseState)(buttonFlags); } }
02389 }
02390
02391 #endregion
02392
02393 #region RawMouse (second try)
02394 #if false
02395 [StructLayout(LayoutKind.Sequential)]
02396 internal struct RawMouse
02397 {
02398 byte b00, b01, b02, b03, b04, b05, b06, b07,
02399 b08, b09, b10, b11, b12, b13, b14, b15,
02400 b16, b17, b18, b19, b20, b21, b22, b23;
02401
02402 unsafe private byte* this[int i] { get { fixed (byte* ptr = &b00) { return ptr + i; } } }
02403
02415 internal RawMouseFlags Flags { get { unsafe { return *(RawMouseFlags*)this[0]; } } }
02416
02420 internal RawInputMouseState ButtonFlags { get { unsafe { return *(RawInputMouseState*)this[4]; } } }
02421
02425 internal USHORT ButtonData { get { unsafe { return *(USHORT*)this[6]; } } }
02426
02430 internal ULONG RawButtons { get { unsafe { return *(ULONG*)this[8]; } } }
02431
02435 internal LONG LastX { get { unsafe { return *(LONG*)this[12]; } } }
02436
02440 internal LONG LastY { get { unsafe { return *(LONG*)this[16]; } } }
02441
02445 internal ULONG ExtraInformation { get { unsafe { return *(ULONG*)this[20]; } } }
02446 }
02447 #endif
02448 #endregion
02449
02450 #region RawHID
02451
02462 [StructLayout(LayoutKind.Sequential)]
02463 internal struct RawHID
02464 {
02468 internal DWORD SizeHid;
02472 internal DWORD Count;
02476 internal BYTE RawData;
02477 }
02478
02479 #endregion
02480
02481 #region RawInputDeviceInfo
02482
02487 [StructLayout(LayoutKind.Sequential)]
02488 internal class RawInputDeviceInfo
02489 {
02493 DWORD Size = Marshal.SizeOf(typeof(RawInputDeviceInfo));
02497 internal RawInputDeviceType Type;
02498 internal DeviceStruct Device;
02499 [StructLayout(LayoutKind.Explicit)]
02500 internal struct DeviceStruct
02501 {
02502 [FieldOffset(0)]
02503 internal RawInputMouseDeviceInfo Mouse;
02504 [FieldOffset(0)]
02505 internal RawInputKeyboardDeviceInfo Keyboard;
02506 [FieldOffset(0)]
02507 internal RawInputHIDDeviceInfo HID;
02508 };
02509 }
02510
02511 #endregion
02512
02513 #region RawInputHIDDeviceInfo
02514
02519 [StructLayout(LayoutKind.Sequential)]
02520 internal struct RawInputHIDDeviceInfo
02521 {
02525 internal DWORD VendorId;
02529 internal DWORD ProductId;
02533 internal DWORD VersionNumber;
02537
02538 internal SHORT UsagePage;
02542
02543 internal SHORT Usage;
02544 }
02545
02546 #endregion
02547
02548 #region RawInputKeyboardDeviceInfo
02549
02557 [StructLayout(LayoutKind.Sequential)]
02558 internal struct RawInputKeyboardDeviceInfo
02559 {
02563 internal DWORD Type;
02567 internal DWORD SubType;
02571 internal DWORD KeyboardMode;
02575 internal DWORD NumberOfFunctionKeys;
02579 internal DWORD NumberOfIndicators;
02583 internal DWORD NumberOfKeysTotal;
02584 }
02585
02586 #endregion
02587
02588 #region RawInputMouseDeviceInfo
02589
02597 [StructLayout(LayoutKind.Sequential)]
02598 internal struct RawInputMouseDeviceInfo
02599 {
02603 internal DWORD Id;
02607 internal DWORD NumberOfButtons;
02611 internal DWORD SampleRate;
02618 internal BOOL HasHorizontalWheel;
02619 }
02620
02621 #endregion
02622
02623 #endregion
02624
02625 #region GetWindowLongOffsets
02626
02627 #endregion
02628
02629 #region Rectangle
02630
02638 [StructLayout(LayoutKind.Sequential)]
02639 internal struct Win32Rectangle
02640 {
02641 internal Win32Rectangle(int width, int height)
02642 {
02643 left = top = 0;
02644 right = width;
02645 bottom = height;
02646 }
02647
02651 internal LONG left;
02655 internal LONG top;
02659 internal LONG right;
02663 internal LONG bottom;
02664
02665 internal int Width { get { return right - left; } }
02666 internal int Height { get { return bottom - top; } }
02667
02668 public override string ToString()
02669 {
02670 return String.Format("({0},{1})-({2},{3})", left, top, right, bottom);
02671 }
02672
02673 internal Rectangle ToRectangle()
02674 {
02675 return Rectangle.FromLTRB(left, top, right, bottom);
02676 }
02677
02678 internal static Win32Rectangle From(Rectangle value)
02679 {
02680 Win32Rectangle rect = new Win32Rectangle();
02681 rect.left = value.Left;
02682 rect.right = value.Right;
02683 rect.top = value.Top;
02684 rect.bottom = value.Bottom;
02685 return rect;
02686 }
02687
02688 internal static Win32Rectangle From(Size value)
02689 {
02690 Win32Rectangle rect = new Win32Rectangle();
02691 rect.left = 0;
02692 rect.right = value.Width;
02693 rect.top = 0;
02694 rect.bottom = value.Height;
02695 return rect;
02696 }
02697 }
02698
02699 #endregion
02700
02701 #region WindowInfo
02702
02706 [StructLayout(LayoutKind.Sequential)]
02707 struct WindowInfo
02708 {
02712 public DWORD Size;
02716 public RECT Window;
02720 public RECT Client;
02724 public WindowStyle Style;
02728 public ExtendedWindowStyle ExStyle;
02732 public DWORD WindowStatus;
02736 public UINT WindowBordersX;
02740 public UINT WindowBordersY;
02744 public ATOM WindowType;
02748 public WORD CreatorVersion;
02749 }
02750
02751 #endregion
02752
02753 #region MonitorInfo
02754
02755 struct MonitorInfo
02756 {
02757 public DWORD Size;
02758 public RECT Monitor;
02759 public RECT Work;
02760 public DWORD Flags;
02761
02762 public static readonly int SizeInBytes = Marshal.SizeOf(default(MonitorInfo));
02763 }
02764
02765 #endregion
02766
02767 #region NcCalculateSize
02768
02769 [StructLayout(LayoutKind.Sequential, Pack=1)]
02770 internal struct NcCalculateSize
02771 {
02772 public Win32Rectangle NewBounds;
02773 public Win32Rectangle OldBounds;
02774 public Win32Rectangle OldClientRectangle;
02775 unsafe public WindowPosition* Position;
02776 }
02777
02778 #endregion
02779
02780 #region ShFileInfo
02781
02782 [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
02783 struct SHFILEINFO
02784 {
02785 public IntPtr hIcon;
02786 public int iIcon;
02787 public uint dwAttributes;
02788 [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)]
02789 public string szDisplayName;
02790 [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 80)]
02791 public string szTypeName;
02792 };
02793
02794 #endregion
02795
02796 #region TrackMouseEventStructure
02797
02798 struct TrackMouseEventStructure
02799 {
02800 public DWORD Size;
02801 public TrackMouseEventFlags Flags;
02802 public HWND TrackWindowHandle;
02803 public DWORD HoverTime;
02804
02805 public static readonly int SizeInBytes = Marshal.SizeOf(typeof(TrackMouseEventStructure));
02806 }
02807
02808 #endregion
02809
02810 #endregion
02811
02812 #region --- Enums ---
02813
02814 #region GetWindowLongOffset
02815
02819 enum GWL
02820 {
02821 WNDPROC = (-4),
02822 HINSTANCE = (-6),
02823 HWNDPARENT = (-8),
02824 STYLE = (-16),
02825 EXSTYLE = (-20),
02826 USERDATA = (-21),
02827 ID = (-12),
02828 }
02829
02830 #endregion
02831
02832 #region SizeMessage
02833
02834 internal enum SizeMessage
02835 {
02836 MAXHIDE = 4,
02837 MAXIMIZED = 2,
02838 MAXSHOW = 3,
02839 MINIMIZED = 1,
02840 RESTORED = 0
02841 }
02842
02843 #endregion
02844
02845 #region NcCalcSizeOptions
02846
02847 internal enum NcCalcSizeOptions
02848 {
02849 ALIGNTOP = 0x10,
02850 ALIGNRIGHT = 0x80,
02851 ALIGNLEFT = 0x20,
02852 ALIGNBOTTOM = 0x40,
02853 HREDRAW = 0x100,
02854 VREDRAW = 0x200,
02855 REDRAW = (HREDRAW | VREDRAW),
02856 VALIDRECTS = 0x400
02857 }
02858
02859 #endregion
02860
02861 #region internal enum DisplayModeSettingsEnum
02862
02863 internal enum DisplayModeSettingsEnum
02864 {
02865 CurrentSettings = -1,
02866 RegistrySettings = -2
02867 }
02868
02869 #endregion
02870
02871 #region internal enum DisplayDeviceStateFlags
02872
02873 [Flags]
02874 internal enum DisplayDeviceStateFlags
02875 {
02876 None = 0x00000000,
02877 AttachedToDesktop = 0x00000001,
02878 MultiDriver = 0x00000002,
02879 PrimaryDevice = 0x00000004,
02880 MirroringDriver = 0x00000008,
02881 VgaCompatible = 0x00000010,
02882 Removable = 0x00000020,
02883 ModesPruned = 0x08000000,
02884 Remote = 0x04000000,
02885 Disconnect = 0x02000000,
02886
02887
02888 Active = 0x00000001,
02889 Attached = 0x00000002,
02890 }
02891
02892 #endregion
02893
02894 #region internal enum ChangeDisplaySettingsEnum
02895
02896 [Flags]
02897 internal enum ChangeDisplaySettingsEnum
02898 {
02899
02900 UpdateRegistry = 0x00000001,
02901 Test = 0x00000002,
02902 Fullscreen = 0x00000004,
02903 }
02904
02905 #endregion
02906
02907 #region internal enum WindowStyle : uint
02908
02909 [Flags]
02910 internal enum WindowStyle : uint
02911 {
02912 Overlapped = 0x00000000,
02913 Popup = 0x80000000,
02914 Child = 0x40000000,
02915 Minimize = 0x20000000,
02916 Visible = 0x10000000,
02917 Disabled = 0x08000000,
02918 ClipSiblings = 0x04000000,
02919 ClipChildren = 0x02000000,
02920 Maximize = 0x01000000,
02921 Caption = 0x00C00000,
02922 Border = 0x00800000,
02923 DialogFrame = 0x00400000,
02924 VScroll = 0x00200000,
02925 HScreen = 0x00100000,
02926 SystemMenu = 0x00080000,
02927 ThickFrame = 0x00040000,
02928 Group = 0x00020000,
02929 TabStop = 0x00010000,
02930
02931 MinimizeBox = 0x00020000,
02932 MaximizeBox = 0x00010000,
02933
02934 Tiled = Overlapped,
02935 Iconic = Minimize,
02936 SizeBox = ThickFrame,
02937 TiledWindow = OverlappedWindow,
02938
02939
02940 OverlappedWindow = Overlapped | Caption | SystemMenu | ThickFrame | MinimizeBox | MaximizeBox,
02941 PopupWindow = Popup | Border | SystemMenu,
02942 ChildWindow = Child
02943 }
02944
02945 #endregion
02946
02947 #region internal enum ExtendedWindowStyle : uint
02948
02949 [Flags]
02950 internal enum ExtendedWindowStyle : uint
02951 {
02952 DialogModalFrame = 0x00000001,
02953 NoParentNotify = 0x00000004,
02954 Topmost = 0x00000008,
02955 AcceptFiles = 0x00000010,
02956 Transparent = 0x00000020,
02957
02958
02959 MdiChild = 0x00000040,
02960 ToolWindow = 0x00000080,
02961 WindowEdge = 0x00000100,
02962 ClientEdge = 0x00000200,
02963 ContextHelp = 0x00000400,
02964
02965
02966
02967 Right = 0x00001000,
02968 Left = 0x00000000,
02969 RightToLeftReading = 0x00002000,
02970 LeftToRightReading = 0x00000000,
02971 LeftScrollbar = 0x00004000,
02972 RightScrollbar = 0x00000000,
02973
02974 ControlParent = 0x00010000,
02975 StaticEdge = 0x00020000,
02976 ApplicationWindow = 0x00040000,
02977
02978 OverlappedWindow = WindowEdge | ClientEdge,
02979 PaletteWindow = WindowEdge | ToolWindow | Topmost,
02980
02981
02982
02983 Layered = 0x00080000,
02984
02985
02986
02987 NoInheritLayout = 0x00100000,
02988 RightToLeftLayout = 0x00400000,
02989
02990
02991
02992 Composited = 0x02000000,
02993
02994
02995
02996 NoActivate = 0x08000000
02997
02998 }
02999
03000 #endregion
03001
03002 #region GetWindowLongOffsets enum
03003
03004 internal enum GetWindowLongOffsets : int
03005 {
03006 WNDPROC = (-4),
03007 HINSTANCE = (-6),
03008 HWNDPARENT = (-8),
03009 STYLE = (-16),
03010 EXSTYLE = (-20),
03011 USERDATA = (-21),
03012 ID = (-12),
03013 }
03014
03015 #endregion
03016
03017 #region PixelFormatDescriptorFlags enum
03018 [Flags]
03019 internal enum PixelFormatDescriptorFlags : int
03020 {
03021
03022 DOUBLEBUFFER = 0x01,
03023 STEREO = 0x02,
03024 DRAW_TO_WINDOW = 0x04,
03025 DRAW_TO_BITMAP = 0x08,
03026 SUPPORT_GDI = 0x10,
03027 SUPPORT_OPENGL = 0x20,
03028 GENERIC_FORMAT = 0x40,
03029 NEED_PALETTE = 0x80,
03030 NEED_SYSTEM_PALETTE = 0x100,
03031 SWAP_EXCHANGE = 0x200,
03032 SWAP_COPY = 0x400,
03033 SWAP_LAYER_BUFFERS = 0x800,
03034 GENERIC_ACCELERATED = 0x1000,
03035 SUPPORT_DIRECTDRAW = 0x2000,
03036
03037
03038 DEPTH_DONTCARE = unchecked((int)0x20000000),
03039 DOUBLEBUFFER_DONTCARE = unchecked((int)0x40000000),
03040 STEREO_DONTCARE = unchecked((int)0x80000000)
03041 }
03042 #endregion
03043
03044 #region PixelType
03045
03046 internal enum PixelType : byte
03047 {
03048 RGBA = 0,
03049 INDEXED = 1
03050 }
03051
03052 #endregion
03053
03054 #region WindowPlacementOptions enum
03055
03056 internal enum WindowPlacementOptions
03057 {
03058 TOP = 0,
03059 BOTTOM = 1,
03060 TOPMOST = -1,
03061 NOTOPMOST = -2
03062 }
03063
03064 #endregion
03065
03066 #region ClassStyle enum
03067 [Flags]
03068 internal enum ClassStyle
03069 {
03070
03071 VRedraw = 0x0001,
03072 HRedraw = 0x0002,
03073 DoubleClicks = 0x0008,
03074 OwnDC = 0x0020,
03075 ClassDC = 0x0040,
03076 ParentDC = 0x0080,
03077 NoClose = 0x0200,
03078 SaveBits = 0x0800,
03079 ByteAlignClient = 0x1000,
03080 ByteAlignWindow = 0x2000,
03081 GlobalClass = 0x4000,
03082
03083 Ime = 0x00010000,
03084
03085
03086 DropShadow = 0x00020000
03087
03088 }
03089 #endregion
03090
03091 #region RawInputDeviceFlags enum
03092
03093 [Flags]
03094 internal enum RawInputDeviceFlags : int
03095 {
03100 REMOVE = 0x00000001,
03105 EXCLUDE = 0x00000010,
03110 PAGEONLY = 0x00000020,
03115 NOLEGACY = 0x00000030,
03120 INPUTSINK = 0x00000100,
03124 CAPTUREMOUSE = 0x00000200,
03131 NOHOTKEYS = 0x00000200,
03135 APPKEYS = 0x00000400,
03141 EXINPUTSINK = 0x00001000,
03142 DEVNOTIFY = 0x00002000,
03143
03144 }
03145
03146 #endregion
03147
03148 #region GetRawInputDataEnum
03149
03150 internal enum GetRawInputDataEnum
03151 {
03152 INPUT = 0x10000003,
03153 HEADER = 0x10000005
03154 }
03155
03156 #endregion
03157
03158 #region RawInputDeviceInfoEnum
03159
03160 internal enum RawInputDeviceInfoEnum
03161 {
03162 PREPARSEDDATA = 0x20000005,
03163 DEVICENAME = 0x20000007,
03164 DEVICEINFO = 0x2000000b
03165 }
03166
03167 #endregion
03168
03169 #region RawInputMouseState
03170
03171 [Flags]
03172 internal enum RawInputMouseState : ushort
03173 {
03174 LEFT_BUTTON_DOWN = 0x0001,
03175 LEFT_BUTTON_UP = 0x0002,
03176 RIGHT_BUTTON_DOWN = 0x0004,
03177 RIGHT_BUTTON_UP = 0x0008,
03178 MIDDLE_BUTTON_DOWN = 0x0010,
03179 MIDDLE_BUTTON_UP = 0x0020,
03180
03181 BUTTON_1_DOWN = LEFT_BUTTON_DOWN,
03182 BUTTON_1_UP = LEFT_BUTTON_UP,
03183 BUTTON_2_DOWN = RIGHT_BUTTON_DOWN,
03184 BUTTON_2_UP = RIGHT_BUTTON_UP,
03185 BUTTON_3_DOWN = MIDDLE_BUTTON_DOWN,
03186 BUTTON_3_UP = MIDDLE_BUTTON_UP,
03187
03188 BUTTON_4_DOWN = 0x0040,
03189 BUTTON_4_UP = 0x0080,
03190 BUTTON_5_DOWN = 0x0100,
03191 BUTTON_5_UP = 0x0200,
03192
03193 WHEEL = 0x0400
03194 }
03195
03196 #endregion
03197
03198 #region RawInputKeyboardDataFlags
03199
03200 internal enum RawInputKeyboardDataFlags : short
03201 {
03202 MAKE = 0,
03203 BREAK = 1,
03204 E0 = 2,
03205 E1 = 4,
03206 TERMSRV_SET_LED = 8,
03207 TERMSRV_SHADOW = 0x10
03208 }
03209
03210 #endregion
03211
03212 #region RawInputDeviceType
03213
03214 internal enum RawInputDeviceType : int
03215 {
03216 MOUSE = 0,
03217 KEYBOARD = 1,
03218 HID = 2
03219 }
03220
03221 #endregion
03222
03223 #region RawMouseFlags
03224
03228 internal enum RawMouseFlags : ushort
03229 {
03233 MOUSE_MOVE_RELATIVE = 0x00,
03237 MOUSE_MOVE_ABSOLUTE = 0x01,
03241 MOUSE_VIRTUAL_DESKTOP = 0x02,
03245 MOUSE_ATTRIBUTES_CHANGED = 0x04,
03246 }
03247
03248 #endregion
03249
03250 #region VirtualKeys
03251
03252 internal enum VirtualKeys : short
03253 {
03254
03255
03256
03257 LBUTTON = 0x01,
03258 RBUTTON = 0x02,
03259 CANCEL = 0x03,
03260 MBUTTON = 0x04,
03261
03262 XBUTTON1 = 0x05,
03263 XBUTTON2 = 0x06,
03264
03265
03266
03267
03268
03269 BACK = 0x08,
03270 TAB = 0x09,
03271
03272
03273
03274
03275
03276 CLEAR = 0x0C,
03277 RETURN = 0x0D,
03278
03279 SHIFT = 0x10,
03280 CONTROL = 0x11,
03281 MENU = 0x12,
03282 PAUSE = 0x13,
03283 CAPITAL = 0x14,
03284
03285 KANA = 0x15,
03286 HANGEUL = 0x15,
03287 HANGUL = 0x15,
03288 JUNJA = 0x17,
03289 FINAL = 0x18,
03290 HANJA = 0x19,
03291 KANJI = 0x19,
03292
03293 ESCAPE = 0x1B,
03294
03295 CONVERT = 0x1C,
03296 NONCONVERT = 0x1D,
03297 ACCEPT = 0x1E,
03298 MODECHANGE = 0x1F,
03299
03300 SPACE = 0x20,
03301 PRIOR = 0x21,
03302 NEXT = 0x22,
03303 END = 0x23,
03304 HOME = 0x24,
03305 LEFT = 0x25,
03306 UP = 0x26,
03307 RIGHT = 0x27,
03308 DOWN = 0x28,
03309 SELECT = 0x29,
03310 PRINT = 0x2A,
03311 EXECUTE = 0x2B,
03312 SNAPSHOT = 0x2C,
03313 INSERT = 0x2D,
03314 DELETE = 0x2E,
03315 HELP = 0x2F,
03316
03317
03318
03319
03320
03321
03322
03323 LWIN = 0x5B,
03324 RWIN = 0x5C,
03325 APPS = 0x5D,
03326
03327
03328
03329
03330
03331 SLEEP = 0x5F,
03332
03333 NUMPAD0 = 0x60,
03334 NUMPAD1 = 0x61,
03335 NUMPAD2 = 0x62,
03336 NUMPAD3 = 0x63,
03337 NUMPAD4 = 0x64,
03338 NUMPAD5 = 0x65,
03339 NUMPAD6 = 0x66,
03340 NUMPAD7 = 0x67,
03341 NUMPAD8 = 0x68,
03342 NUMPAD9 = 0x69,
03343 MULTIPLY = 0x6A,
03344 ADD = 0x6B,
03345 SEPARATOR = 0x6C,
03346 SUBTRACT = 0x6D,
03347 DECIMAL = 0x6E,
03348 DIVIDE = 0x6F,
03349 F1 = 0x70,
03350 F2 = 0x71,
03351 F3 = 0x72,
03352 F4 = 0x73,
03353 F5 = 0x74,
03354 F6 = 0x75,
03355 F7 = 0x76,
03356 F8 = 0x77,
03357 F9 = 0x78,
03358 F10 = 0x79,
03359 F11 = 0x7A,
03360 F12 = 0x7B,
03361 F13 = 0x7C,
03362 F14 = 0x7D,
03363 F15 = 0x7E,
03364 F16 = 0x7F,
03365 F17 = 0x80,
03366 F18 = 0x81,
03367 F19 = 0x82,
03368 F20 = 0x83,
03369 F21 = 0x84,
03370 F22 = 0x85,
03371 F23 = 0x86,
03372 F24 = 0x87,
03373
03374
03375
03376
03377
03378 NUMLOCK = 0x90,
03379 SCROLL = 0x91,
03380
03381
03382
03383
03384 OEM_NEC_EQUAL= 0x92,
03385
03386
03387
03388
03389 OEM_FJ_JISHO = 0x92,
03390 OEM_FJ_MASSHOU = 0x93,
03391 OEM_FJ_TOUROKU = 0x94,
03392 OEM_FJ_LOYA = 0x95,
03393 OEM_FJ_ROYA = 0x96,
03394
03395
03396
03397
03398
03399
03400
03401
03402
03403
03404 LSHIFT = 0xA0,
03405 RSHIFT = 0xA1,
03406 LCONTROL = 0xA2,
03407 RCONTROL = 0xA3,
03408 LMENU = 0xA4,
03409 RMENU = 0xA5,
03410
03411 BROWSER_BACK = 0xA6,
03412 BROWSER_FORWARD = 0xA7,
03413 BROWSER_REFRESH = 0xA8,
03414 BROWSER_STOP = 0xA9,
03415 BROWSER_SEARCH = 0xAA,
03416 BROWSER_FAVORITES = 0xAB,
03417 BROWSER_HOME = 0xAC,
03418
03419 VOLUME_MUTE = 0xAD,
03420 VOLUME_DOWN = 0xAE,
03421 VOLUME_UP = 0xAF,
03422 MEDIA_NEXT_TRACK = 0xB0,
03423 MEDIA_PREV_TRACK = 0xB1,
03424 MEDIA_STOP = 0xB2,
03425 MEDIA_PLAY_PAUSE = 0xB3,
03426 LAUNCH_MAIL = 0xB4,
03427 LAUNCH_MEDIA_SELECT = 0xB5,
03428 LAUNCH_APP1 = 0xB6,
03429 LAUNCH_APP2 = 0xB7,
03430
03431
03432
03433
03434
03435 OEM_1 = 0xBA,
03436 OEM_PLUS = 0xBB,
03437 OEM_COMMA = 0xBC,
03438 OEM_MINUS = 0xBD,
03439 OEM_PERIOD = 0xBE,
03440 OEM_2 = 0xBF,
03441 OEM_3 = 0xC0,
03442
03443
03444
03445
03446
03447
03448
03449
03450
03451 OEM_4 = 0xDB,
03452 OEM_5 = 0xDC,
03453 OEM_6 = 0xDD,
03454 OEM_7 = 0xDE,
03455 OEM_8 = 0xDF,
03456
03457
03458
03459
03460
03461
03462
03463
03464 OEM_AX = 0xE1,
03465 OEM_102 = 0xE2,
03466 ICO_HELP = 0xE3,
03467 ICO_00 = 0xE4,
03468
03469 PROCESSKEY = 0xE5,
03470
03471 ICO_CLEAR = 0xE6,
03472
03473
03474 PACKET = 0xE7,
03475
03476
03477
03478
03479
03480
03481
03482
03483 OEM_RESET = 0xE9,
03484 OEM_JUMP = 0xEA,
03485 OEM_PA1 = 0xEB,
03486 OEM_PA2 = 0xEC,
03487 OEM_PA3 = 0xED,
03488 OEM_WSCTRL = 0xEE,
03489 OEM_CUSEL = 0xEF,
03490 OEM_ATTN = 0xF0,
03491 OEM_FINISH = 0xF1,
03492 OEM_COPY = 0xF2,
03493 OEM_AUTO = 0xF3,
03494 OEM_ENLW = 0xF4,
03495 OEM_BACKTAB = 0xF5,
03496
03497 ATTN = 0xF6,
03498 CRSEL = 0xF7,
03499 EXSEL = 0xF8,
03500 EREOF = 0xF9,
03501 PLAY = 0xFA,
03502 ZOOM = 0xFB,
03503 NONAME = 0xFC,
03504 PA1 = 0xFD,
03505 OEM_CLEAR = 0xFE,
03506
03507 Last
03508 }
03509
03510 #endregion
03511
03512 #region MouseKeys
03513
03517 enum MouseKeys
03518 {
03519
03520
03521 None = 0,
03522
03523
03524
03525 Left = 0x0001,
03526
03527
03528
03529 Right = 0x0002,
03530
03531
03532
03533 Middle = 0x0010,
03534
03535
03536
03537 XButton1 = 0x0020,
03538
03539
03540
03541 XButton2 = 0x0040,
03542 }
03543
03544 #endregion
03545
03546 #region QueueStatusFlags
03547
03552 [Flags]
03553 internal enum QueueStatusFlags
03554 {
03558 KEY = 0x0001,
03562 MOUSEMOVE = 0x0002,
03566 MOUSEBUTTON = 0x0004,
03570 POSTMESSAGE = 0x0008,
03574 TIMER = 0x0010,
03578 PAINT = 0x0020,
03582 SENDMESSAGE = 0x0040,
03586 HOTKEY = 0x0080,
03590 ALLPOSTMESSAGE = 0x0100,
03595 RAWINPUT = 0x0400,
03599 MOUSE = MOUSEMOVE | MOUSEBUTTON,
03604 INPUT = MOUSE | KEY | RAWINPUT,
03609 INPUT_LEGACY = MOUSE | KEY,
03613 ALLEVENTS = INPUT | POSTMESSAGE | TIMER | PAINT | HOTKEY,
03617 ALLINPUT = INPUT | POSTMESSAGE | TIMER | PAINT | HOTKEY | SENDMESSAGE
03618 }
03619
03620 #endregion
03621
03622 #region WindowMessage
03623
03624 internal enum WindowMessage : uint
03625 {
03626 NULL = 0x0000,
03627 CREATE = 0x0001,
03628 DESTROY = 0x0002,
03629 MOVE = 0x0003,
03630 SIZE = 0x0005,
03631 ACTIVATE = 0x0006,
03632 SETFOCUS = 0x0007,
03633 KILLFOCUS = 0x0008,
03634
03635 ENABLE = 0x000A,
03636 SETREDRAW = 0x000B,
03637 SETTEXT = 0x000C,
03638 GETTEXT = 0x000D,
03639 GETTEXTLENGTH = 0x000E,
03640 PAINT = 0x000F,
03641 CLOSE = 0x0010,
03642 QUERYENDSESSION = 0x0011,
03643 QUIT = 0x0012,
03644 QUERYOPEN = 0x0013,
03645 ERASEBKGND = 0x0014,
03646 SYSCOLORCHANGE = 0x0015,
03647 ENDSESSION = 0x0016,
03648
03649 SHOWWINDOW = 0x0018,
03650 CTLCOLOR = 0x0019,
03651 WININICHANGE = 0x001A,
03652 SETTINGCHANGE = 0x001A,
03653 DEVMODECHANGE = 0x001B,
03654 ACTIVATEAPP = 0x001C,
03655 FONTCHANGE = 0x001D,
03656 TIMECHANGE = 0x001E,
03657 CANCELMODE = 0x001F,
03658 SETCURSOR = 0x0020,
03659 MOUSEACTIVATE = 0x0021,
03660 CHILDACTIVATE = 0x0022,
03661 QUEUESYNC = 0x0023,
03662 GETMINMAXINFO = 0x0024,
03663 PAINTICON = 0x0026,
03664 ICONERASEBKGND = 0x0027,
03665 NEXTDLGCTL = 0x0028,
03666
03667 SPOOLERSTATUS = 0x002A,
03668 DRAWITEM = 0x002B,
03669 MEASUREITEM = 0x002C,
03670 DELETEITEM = 0x002D,
03671 VKEYTOITEM = 0x002E,
03672 CHARTOITEM = 0x002F,
03673 SETFONT = 0x0030,
03674 GETFONT = 0x0031,
03675 SETHOTKEY = 0x0032,
03676 GETHOTKEY = 0x0033,
03677
03678
03679
03680 QUERYDRAGICON = 0x0037,
03681 COMPAREITEM = 0x0039,
03682
03683
03684 GETOBJECT = 0x003D,
03685
03686 COMPACTING = 0x0041,
03687 COMMNOTIFY = 0x0044,
03688 WINDOWPOSCHANGING = 0x0046,
03689 WINDOWPOSCHANGED = 0x0047,
03690 POWER = 0x0048,
03691 COPYDATA = 0x004A,
03692 CANCELJOURNAL = 0x004B,
03693 NOTIFY = 0x004E,
03694 INPUTLANGCHANGEREQUEST = 0x0050,
03695 INPUTLANGCHANGE = 0x0051,
03696 TCARD = 0x0052,
03697 HELP = 0x0053,
03698 USERCHANGED = 0x0054,
03699 NOTIFYFORMAT = 0x0055,
03700 CONTEXTMENU = 0x007B,
03701 STYLECHANGING = 0x007C,
03702 STYLECHANGED = 0x007D,
03703 DISPLAYCHANGE = 0x007E,
03704 GETICON = 0x007F,
03705
03706
03707 SETICON = 0x0080,
03708 NCCREATE = 0x0081,
03709 NCDESTROY = 0x0082,
03710 NCCALCSIZE = 0x0083,
03711 NCHITTEST = 0x0084,
03712 NCPAINT = 0x0085,
03713 NCACTIVATE = 0x0086,
03714 GETDLGCODE = 0x0087,
03715 SYNCPAINT = 0x0088,
03716
03717 NCMOUSEMOVE = 0x00A0,
03718 NCLBUTTONDOWN = 0x00A1,
03719 NCLBUTTONUP = 0x00A2,
03720 NCLBUTTONDBLCLK = 0x00A3,
03721 NCRBUTTONDOWN = 0x00A4,
03722 NCRBUTTONUP = 0x00A5,
03723 NCRBUTTONDBLCLK = 0x00A6,
03724 NCMBUTTONDOWN = 0x00A7,
03725 NCMBUTTONUP = 0x00A8,
03726 NCMBUTTONDBLCLK = 0x00A9,
03730 NCXBUTTONDOWN = 0x00ab,
03734 NCXBUTTONUP = 0x00ac,
03738 NCXBUTTONDBLCLK = 0x00ad,
03739
03740 INPUT = 0x00FF,
03741
03742 KEYDOWN = 0x0100,
03743 KEYFIRST = 0x0100,
03744 KEYUP = 0x0101,
03745 CHAR = 0x0102,
03746 DEADCHAR = 0x0103,
03747 SYSKEYDOWN = 0x0104,
03748 SYSKEYUP = 0x0105,
03749 SYSCHAR = 0x0106,
03750 SYSDEADCHAR = 0x0107,
03751 KEYLAST = 0x0108,
03752 IME_STARTCOMPOSITION = 0x010D,
03753 IME_ENDCOMPOSITION = 0x010E,
03754 IME_COMPOSITION = 0x010F,
03755 IME_KEYLAST = 0x010F,
03756 INITDIALOG = 0x0110,
03757 COMMAND = 0x0111,
03758 SYSCOMMAND = 0x0112,
03759 TIMER = 0x0113,
03760 HSCROLL = 0x0114,
03761 VSCROLL = 0x0115,
03762 INITMENU = 0x0116,
03763 INITMENUPOPUP = 0x0117,
03764
03765 MENUSELECT = 0x011F,
03766 MENUCHAR = 0x0120,
03767 ENTERIDLE = 0x0121,
03768 MENURBUTTONUP = 0x0122,
03769 MENUDRAG = 0x0123,
03770 MENUGETOBJECT = 0x0124,
03771 UNINITMENUPOPUP = 0x0125,
03772 MENUCOMMAND = 0x0126,
03773
03774 CHANGEUISTATE = 0x0127,
03775 UPDATEUISTATE = 0x0128,
03776 QUERYUISTATE = 0x0129,
03777
03778
03779 CTLCOLORMSGBOX = 0x0132,
03780 CTLCOLOREDIT = 0x0133,
03781 CTLCOLORLISTBOX = 0x0134,
03782 CTLCOLORBTN = 0x0135,
03783 CTLCOLORDLG = 0x0136,
03784 CTLCOLORSCROLLBAR = 0x0137,
03785 CTLCOLORSTATIC = 0x0138,
03786 MOUSEMOVE = 0x0200,
03787 MOUSEFIRST = 0x0200,
03788 LBUTTONDOWN = 0x0201,
03789 LBUTTONUP = 0x0202,
03790 LBUTTONDBLCLK = 0x0203,
03791 RBUTTONDOWN = 0x0204,
03792 RBUTTONUP = 0x0205,
03793 RBUTTONDBLCLK = 0x0206,
03794 MBUTTONDOWN = 0x0207,
03795 MBUTTONUP = 0x0208,
03796 MBUTTONDBLCLK = 0x0209,
03797 MOUSEWHEEL = 0x020A,
03798 MOUSELAST = 0x020D,
03802 XBUTTONDOWN = 0x020B,
03806 XBUTTONUP = 0x020C,
03810 XBUTTONDBLCLK = 0x020D,
03811 PARENTNOTIFY = 0x0210,
03812 ENTERMENULOOP = 0x0211,
03813 EXITMENULOOP = 0x0212,
03814 NEXTMENU = 0x0213,
03815 SIZING = 0x0214,
03816 CAPTURECHANGED = 0x0215,
03817 MOVING = 0x0216,
03818
03819 DEVICECHANGE = 0x0219,
03820 MDICREATE = 0x0220,
03821 MDIDESTROY = 0x0221,
03822 MDIACTIVATE = 0x0222,
03823 MDIRESTORE = 0x0223,
03824 MDINEXT = 0x0224,
03825 MDIMAXIMIZE = 0x0225,
03826 MDITILE = 0x0226,
03827 MDICASCADE = 0x0227,
03828 MDIICONARRANGE = 0x0228,
03829 MDIGETACTIVE = 0x0229,
03830
03831
03832
03833
03834
03835
03836
03837 MDISETMENU = 0x0230,
03838 ENTERSIZEMOVE = 0x0231,
03839 EXITSIZEMOVE = 0x0232,
03840 DROPFILES = 0x0233,
03841 MDIREFRESHMENU = 0x0234,
03842 IME_SETCONTEXT = 0x0281,
03843 IME_NOTIFY = 0x0282,
03844 IME_CONTROL = 0x0283,
03845 IME_COMPOSITIONFULL = 0x0284,
03846 IME_SELECT = 0x0285,
03847 IME_CHAR = 0x0286,
03848 IME_REQUEST = 0x0288,
03849 IME_KEYDOWN = 0x0290,
03850 IME_KEYUP = 0x0291,
03851 NCMOUSEHOVER = 0x02A0,
03852 MOUSEHOVER = 0x02A1,
03853 NCMOUSELEAVE = 0x02A2,
03854 MOUSELEAVE = 0x02A3,
03855 CUT = 0x0300,
03856 COPY = 0x0301,
03857 PASTE = 0x0302,
03858 CLEAR = 0x0303,
03859 UNDO = 0x0304,
03860 RENDERFORMAT = 0x0305,
03861 RENDERALLFORMATS = 0x0306,
03862 DESTROYCLIPBOARD = 0x0307,
03863 DRAWCLIPBOARD = 0x0308,
03864 PAINTCLIPBOARD = 0x0309,
03865 VSCROLLCLIPBOARD = 0x030A,
03866 SIZECLIPBOARD = 0x030B,
03867 ASKCBFORMATNAME = 0x030C,
03868 CHANGECBCHAIN = 0x030D,
03869 HSCROLLCLIPBOARD = 0x030E,
03870 QUERYNEWPALETTE = 0x030F,
03871 PALETTEISCHANGING = 0x0310,
03872 PALETTECHANGED = 0x0311,
03873 HOTKEY = 0x0312,
03874 PRINT = 0x0317,
03875 PRINTCLIENT = 0x0318,
03876 HANDHELDFIRST = 0x0358,
03877 HANDHELDLAST = 0x035F,
03878 AFXFIRST = 0x0360,
03879 AFXLAST = 0x037F,
03880 PENWINFIRST = 0x0380,
03881 PENWINLAST = 0x038F,
03882 APP = 0x8000,
03883 USER = 0x0400,
03884
03885
03886 MOUSE_ENTER = 0x0401,
03887 ASYNC_MESSAGE = 0x0403,
03888 REFLECT = USER + 0x1c00,
03889 CLOSE_INTERNAL = USER + 0x1c01,
03890
03891
03892 BALLOONSHOW = USER + 0x0002,
03893 BALLOONHIDE = USER + 0x0003,
03894 BALLOONTIMEOUT = USER + 0x0004,
03895 BALLOONUSERCLICK = USER + 0x0005
03896 }
03897
03898 #endregion
03899
03900 #region ShowWindowCommand
03901
03905 internal enum ShowWindowCommand
03906 {
03910 HIDE = 0,
03914 SHOWNORMAL = 1,
03915 NORMAL = 1,
03919 SHOWMINIMIZED = 2,
03923 SHOWMAXIMIZED = 3,
03924 MAXIMIZE = 3,
03928 SHOWNOACTIVATE = 4,
03932 SHOW = 5,
03936 MINIMIZE = 6,
03940 SHOWMINNOACTIVE = 7,
03944 SHOWNA = 8,
03948 RESTORE = 9,
03952 SHOWDEFAULT = 10,
03956 FORCEMINIMIZE = 11,
03957
03958
03959
03960
03961
03962
03963
03964
03965 }
03966
03967 #endregion
03968
03969 #region ShowWindowMessageIdentifiers
03970
03974 internal enum ShowWindowMessageIdentifiers
03975 {
03976 PARENTCLOSING = 1,
03977 OTHERZOOM = 2,
03978 PARENTOPENING = 3,
03979 OTHERUNZOOM = 4,
03980 }
03981
03982 #endregion
03983
03984 #region GDI charset
03985
03989 internal enum GdiCharset
03990 {
03991 Ansi = 0,
03992 Default = 1,
03993 Symbol = 2,
03994 ShiftJIS = 128,
03995 Hangeul = 129,
03996 Hangul = 129,
03997 GB2312 = 134,
03998 ChineseBig5 = 136,
03999 OEM = 255,
04000
04001 Johab = 130,
04002 Hebrew = 177,
04003 Arabic = 178,
04004 Greek = 161,
04005 Turkish = 162,
04006 Vietnamese = 163,
04007 Thai = 222,
04008 EastEurope = 238,
04009 Russian = 204,
04010 Mac = 77,
04011 Baltic = 186,
04012 }
04013
04014 #endregion
04015
04016 #region MapVirtualKeyType
04017
04018 internal enum MapVirtualKeyType
04019 {
04021 VirtualKeyToScanCode = 0,
04023 ScanCodeToVirtualKey = 1,
04025 VirtualKeyToCharacter = 2,
04027 ScanCodeToVirtualKeyExtended = 3,
04028 VirtualKeyToScanCodeExtended = 4,
04029 }
04030
04031 #endregion
04032
04033 #region DwmWindowAttribute
04034
04035 enum DwmWindowAttribute
04036 {
04037 NCRENDERING_ENABLED = 1,
04038 NCRENDERING_POLICY,
04039 TRANSITIONS_FORCEDISABLED,
04040 ALLOW_NCPAINT,
04041 CAPTION_BUTTON_BOUNDS,
04042 NONCLIENT_RTL_LAYOUT,
04043 FORCE_ICONIC_REPRESENTATION,
04044 FLIP3D_POLICY,
04045 EXTENDED_FRAME_BOUNDS,
04046 HAS_ICONIC_BITMAP,
04047 DISALLOW_PEEK,
04048 EXCLUDED_FROM_PEEK,
04049 LAST
04050 }
04051
04052 #endregion
04053
04054 #region ShGetFileIcon
04055
04056 [Flags]
04057 enum ShGetFileIconFlags : int
04058 {
04060 Icon = 0x000000100,
04062 DisplayName = 0x000000200,
04064 TypeName = 0x000000400,
04066 Attributes = 0x000000800,
04068 IconLocation = 0x000001000,
04070 ExeType = 0x000002000,
04072 SysIconIndex = 0x000004000,
04074 LinkOverlay = 0x000008000,
04076 Selected = 0x000010000,
04078 Attr_Specified = 0x000020000,
04080 LargeIcon = 0x000000000,
04082 SmallIcon = 0x000000001,
04084 OpenIcon = 0x000000002,
04086 ShellIconSize = 0x000000004,
04088 PIDL = 0x000000008,
04090 UseFileAttributes = 0x000000010,
04092 AddOverlays = 0x000000020,
04094 OverlayIndex = 0x000000040,
04095 }
04096
04097 #endregion
04098
04099 #region MonitorFrom
04100
04101 enum MonitorFrom
04102 {
04103 Null = 0,
04104 Primary = 1,
04105 Nearest = 2,
04106 }
04107
04108 #endregion
04109
04110 #region CursorName
04111
04112 enum CursorName : int
04113 {
04114 Arrow = 32512
04115 }
04116
04117 #endregion
04118
04119 #region TrackMouseEventFlags
04120
04121 [Flags]
04122 enum TrackMouseEventFlags : uint
04123 {
04124 HOVER = 0x00000001,
04125 LEAVE = 0x00000002,
04126 NONCLIENT = 0x00000010,
04127 QUERY = 0x40000000,
04128 CANCEL = 0x80000000,
04129 }
04130
04131 #endregion
04132
04133 #region MouseActivate
04134
04135 enum MouseActivate
04136 {
04137 ACTIVATE = 1,
04138 ACTIVATEANDEAT = 2,
04139 NOACTIVATE = 3,
04140 NOACTIVATEANDEAT = 4,
04141 }
04142
04143 #endregion
04144
04145 #endregion
04146
04147 #region --- Callbacks ---
04148
04149 internal delegate IntPtr WindowProcedure(IntPtr handle, WindowMessage message, IntPtr wParam, IntPtr lParam);
04150
04151 #region Message
04152
04153 [StructLayout(LayoutKind.Sequential), CLSCompliant(false)]
04154 internal struct MSG
04155 {
04156 internal IntPtr HWnd;
04157 internal WindowMessage Message;
04158 internal IntPtr WParam;
04159 internal IntPtr LParam;
04160 internal uint Time;
04161 internal POINT Point;
04162
04163
04164 public override string ToString()
04165 {
04166 return String.Format("msg=0x{0:x} ({1}) hwnd=0x{2:x} wparam=0x{3:x} lparam=0x{4:x} pt=0x{5:x}", (int)Message, Message.ToString(), HWnd.ToInt32(), WParam.ToInt32(), LParam.ToInt32(), Point);
04167 }
04168 }
04169
04170 #endregion
04171
04172 #region Point
04173
04174 [StructLayout(LayoutKind.Sequential)]
04175 internal struct POINT
04176 {
04177 internal int X;
04178 internal int Y;
04179
04180 internal POINT(int x, int y)
04181 {
04182 this.X = x;
04183 this.Y = y;
04184 }
04185
04186 internal Point ToPoint()
04187 {
04188 return new Point(X, Y);
04189 }
04190
04191 public override string ToString()
04192 {
04193 return "Point {" + X.ToString() + ", " + Y.ToString() + ")";
04194 }
04195 }
04196
04197 #endregion
04198
04199 #endregion
04200 }
04201
04202 #pragma warning restore 3019
04203 #pragma warning restore 0649
04204 #pragma warning restore 0169
04205 #pragma warning restore 0414