├── StrongNameKey.snk
├── GDI
├── Defines
│ ├── PFD_TYPE.cs
│ ├── DMNUP.cs
│ ├── DMORIENT.cs
│ ├── DMCOLOR.cs
│ ├── VP_CP_TYPE.cs
│ ├── DMCOLLATE.cs
│ ├── DMRES.cs
│ ├── VP_CP_CMD.cs
│ ├── VP_COMMAND.cs
│ ├── DMMEDIA.cs
│ ├── PRINTRATEUNIT.cs
│ ├── DMDUP.cs
│ ├── VP_MODE.cs
│ ├── DMTT.cs
│ ├── DMDFO.cs
│ ├── DisplaySettingsMode.cs
│ ├── DCTT.cs
│ ├── DMDISPLAYFLAGS.cs
│ ├── EDS.cs
│ ├── DMICMMETHOD.cs
│ ├── DMDO.cs
│ ├── QUALITY.cs
│ ├── LogFontQuality.cs
│ ├── DMDITHER.cs
│ ├── DMICM.cs
│ ├── DISP_CHANGE.cs
│ ├── CLIP_PRECIS.cs
│ ├── LogFontClipPrecision.cs
│ ├── PitchAndFamily.cs
│ ├── LogFontPitchAndFamily.cs
│ ├── VP_FLAGS.cs
│ ├── DMBIN.cs
│ ├── FW.cs
│ ├── GGO.cs
│ ├── CharSet.cs
│ ├── LogFontCharSet.cs
│ ├── OUT_PRECIS.cs
│ ├── LogFontPrecision.cs
│ ├── CDS.cs
│ ├── VP_TV_STANDARD.cs
│ ├── StockObjectType.cs
│ ├── PFD.cs
│ ├── DC.cs
│ └── DM.cs
├── Structs
│ ├── GlyphMetrics.cs
│ ├── MAT2.cs
│ ├── LogFont.cs
│ ├── VideoParameters.cs
│ └── PixelFormatDescriptor.cs
├── GDI.cs
└── DeviceContext.cs
├── Monitor
├── Defines
│ └── MonitorInfoFlag.cs
├── Structs
│ ├── MonitorInfo.cs
│ └── MonitorInfoEx.cs
└── Monitor.cs
├── IO
├── RawInput
│ ├── Defines
│ │ ├── KEYBOARD.cs
│ │ ├── RID.cs
│ │ ├── RIM_TYPE.cs
│ │ ├── GIDC.cs
│ │ ├── RIM.cs
│ │ ├── RI_KEY.cs
│ │ ├── MOUSE.cs
│ │ ├── RIDI.cs
│ │ ├── RI_MOUSE.cs
│ │ └── RIDEV.cs
│ └── Structs
│ │ ├── RAWINPUTDEVICELIST.cs
│ │ ├── RID_DEVICE_INFO_HID.cs
│ │ ├── RID_DEVICE_INFO_MOUSE.cs
│ │ ├── RID_DEVICE_INFO_KEYBOARD.cs
│ │ ├── RAWINPUT.cs
│ │ ├── RAWHID.cs
│ │ ├── RID_DEVICE_INFO.cs
│ │ ├── RAWINPUTHEADER.cs
│ │ ├── RAWKEYBOARD.cs
│ │ ├── RAWMOUSE.cs
│ │ └── RAWINPUTDEVICE.cs
├── Defines
│ ├── FilePointerMoveMethod.cs
│ ├── FileMode.cs
│ ├── FILE_SHARE.cs
│ ├── FILE_ACTION.cs
│ ├── FILE_NOTIFY_CHANGE.cs
│ ├── FILE_GENERIC.cs
│ ├── SECURITY.cs
│ ├── FileAccess.cs
│ ├── FILE_FLAG.cs
│ └── FILE_ATTRIBUTE.cs
├── Filesystem.cs
└── HumanInterfaceDevices
│ └── Defines
│ ├── HID_USAGE_GENERIC_DEVICE.cs
│ ├── HID_USAGE_VR.cs
│ ├── HID_USAGE_GAME.cs
│ ├── HID_USAGE_SPORT.cs
│ ├── HID_USAGE_PAGE.cs
│ └── HID_USAGE_SIMULATION.cs
├── .gitignore
├── WinDef
├── Point.cs
├── Size.cs
└── Rect.cs
├── WinKernel
├── Defines
│ ├── GENERIC.cs
│ ├── SECURITY_IMPERSONATION_LEVEL.cs
│ ├── ERROR.cs
│ ├── STANDARD_RIGHTS.cs
│ └── ACCESS_MASK.cs
├── Structs
│ ├── GENERIC_MAPPING.cs
│ └── SECURITY_ATTRIBUTES.cs
└── WinKernel.cs
├── README.md
├── LICENSE
├── Properties
└── AssemblyInfo.cs
├── Window
├── Defines
│ ├── DCX.cs
│ ├── SWP.cs
│ ├── CS.cs
│ └── HT.cs
└── Window.cs
└── MultiMedia
└── JoystickData.cs
/StrongNameKey.snk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shintadono/Win32/HEAD/StrongNameKey.snk
--------------------------------------------------------------------------------
/GDI/Defines/PFD_TYPE.cs:
--------------------------------------------------------------------------------
1 | namespace Win32
2 | {
3 | ///
4 | /// Specifies pixel types.
5 | ///
6 | public enum PFD_TYPE : byte
7 | {
8 | ///
9 | /// RGBA pixels.
10 | ///
11 | RGBA=0,
12 |
13 | ///
14 | /// Color-index pixels.
15 | ///
16 | COLORINDEX=1
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Monitor/Defines/MonitorInfoFlag.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Win32
4 | {
5 | ///
6 | /// Specifies flags for monitor devices.
7 | ///
8 | [Flags]
9 | public enum MonitorInfoFlag : uint
10 | {
11 | ///
12 | /// This is the primary display monitor.
13 | ///
14 | PRIMARY=0x00000001,
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/GDI/Defines/DMNUP.cs:
--------------------------------------------------------------------------------
1 | namespace Win32
2 | {
3 | ///
4 | /// Specifies where the NUP is done.
5 | ///
6 | public enum DMNUP : uint
7 | {
8 | ///
9 | /// The print spooler does the NUP.
10 | ///
11 | SYSTEM=1,
12 |
13 | ///
14 | /// The application does the NUP.
15 | ///
16 | ONEUP=2,
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/GDI/Defines/DMORIENT.cs:
--------------------------------------------------------------------------------
1 | namespace Win32
2 | {
3 | ///
4 | /// For printer devices only, selects the orientation of the paper.
5 | ///
6 | public enum DMORIENT : short
7 | {
8 | ///
9 | /// Portrait.
10 | ///
11 | PORTRAIT=1,
12 |
13 | ///
14 | /// Landscape.
15 | ///
16 | LANDSCAPE=2,
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/IO/RawInput/Defines/KEYBOARD.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Win32.IO.RawInput
4 | {
5 | ///
6 | /// Defines the scan code from the key depression.
7 | ///
8 | [CLSCompliant(false)]
9 | public static class KEYBOARD
10 | {
11 | ///
12 | /// The scan code for keyboard overrun.
13 | ///
14 | public const ushort OVERRUN_MAKE_CODE=0xFF;
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/GDI/Defines/DMCOLOR.cs:
--------------------------------------------------------------------------------
1 | namespace Win32
2 | {
3 | ///
4 | /// Switches between color and monochrome on color printers.
5 | ///
6 | public enum DMCOLOR : short
7 | {
8 | ///
9 | /// Print monochrome on color printers.
10 | ///
11 | MONOCHROME=1,
12 |
13 | ///
14 | /// Print color on color printers.
15 | ///
16 | COLOR=2,
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/GDI/Defines/VP_CP_TYPE.cs:
--------------------------------------------------------------------------------
1 | namespace Win32
2 | {
3 | ///
4 | /// Specifies the copy protection type.
5 | ///
6 | public enum VP_CP_TYPE : uint
7 | {
8 | ///
9 | /// Only DVD trigger bits available.
10 | ///
11 | APS_TRIGGER=0x0001,
12 |
13 | ///
14 | /// Full Macrovision data is available.
15 | ///
16 | MACROVISION=0x0002,
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/GDI/Defines/DMCOLLATE.cs:
--------------------------------------------------------------------------------
1 | namespace Win32
2 | {
3 | ///
4 | /// Specifies whether collation should be used when printing multiple copies.
5 | ///
6 | public enum DMCOLLATE : short
7 | {
8 | ///
9 | /// Do not collate when printing multiple copies.
10 | ///
11 | FALSE=0,
12 |
13 | ///
14 | /// Collate when printing multiple copies.
15 | ///
16 | TRUE=1,
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ~
2 | .DS_Store
3 | build/
4 | [Bb]in
5 | [Dd]ebug*/
6 | obj/
7 | [Rr]elease*/
8 | _ReSharper*/
9 | [Tt]est[Rr]esult
10 | [Bb]uild[Ll]og.*
11 | *.swp
12 | *.userprefs
13 | *.obj
14 | *.pdb
15 | *.user
16 | *.aps
17 | *.pch
18 | *.vspscc
19 | *.vssscc
20 | *.pidb
21 | *_i.c
22 | *_p.c
23 | *.ncb
24 | *.suo
25 | *.tlb
26 | *.tlh
27 | *.bak
28 | *.cache
29 | *.ilk
30 | *.log
31 | *.lib
32 | *.sbr
33 | *.scc
34 | *.[Rr]e[Ss]harper
35 | *.zip
36 | *.[Pp]ublish.xml
--------------------------------------------------------------------------------
/WinDef/Point.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.InteropServices;
2 |
3 | namespace Win32
4 | {
5 | ///
6 | /// Defines the x- and y- coordinates of a point.
7 | ///
8 | [StructLayout(LayoutKind.Sequential)]
9 | public struct Point
10 | {
11 | ///
12 | /// The x-coordinate of the point.
13 | ///
14 | public int x;
15 |
16 | ///
17 | /// The y-coordinate of the point.
18 | ///
19 | public int y;
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/GDI/Defines/DMRES.cs:
--------------------------------------------------------------------------------
1 | namespace Win32
2 | {
3 | ///
4 | /// Print quality.
5 | ///
6 | public enum DMRES : short
7 | {
8 | ///
9 | /// Draft quality.
10 | ///
11 | DRAFT=-1,
12 |
13 | ///
14 | /// Low quality.
15 | ///
16 | LOW=-2,
17 |
18 | ///
19 | /// Medium quality.
20 | ///
21 | MEDIUM=-3,
22 |
23 | ///
24 | /// High quality.
25 | ///
26 | HIGH=-4,
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/GDI/Defines/VP_CP_CMD.cs:
--------------------------------------------------------------------------------
1 | namespace Win32
2 | {
3 | ///
4 | /// Specifies the copy protection command.
5 | ///
6 | public enum VP_CP_CMD : uint
7 | {
8 | ///
9 | /// Activate copy protection.
10 | ///
11 | ACTIVATE=0x0001,
12 |
13 | ///
14 | /// Deactivate copy protection.
15 | ///
16 | DEACTIVATE=0x0002,
17 |
18 | ///
19 | /// Change copy protection.
20 | ///
21 | CHANGE=0x0004,
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/GDI/Defines/VP_COMMAND.cs:
--------------------------------------------------------------------------------
1 | namespace Win32
2 | {
3 | ///
4 | /// Specifies whether to retrieve or set the values that the other members of this structure specify.
5 | ///
6 | public enum VP_COMMAND : uint
7 | {
8 | ///
9 | /// Gets current video capabilities. If video capability is not supported, is 0.
10 | ///
11 | GET=0x0001,
12 |
13 | ///
14 | /// Sets video parameters.
15 | ///
16 | SET=0x0002,
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/IO/RawInput/Defines/RID.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Win32.IO.RawInput
4 | {
5 | ///
6 | /// Defines the command flag for .
7 | ///
8 | [CLSCompliant(false)]
9 | public enum RID : uint
10 | {
11 | ///
12 | /// Get the header information from the structure.
13 | ///
14 | HEADER=0x10000005,
15 |
16 | ///
17 | /// Get the raw data from the structure.
18 | ///
19 | INPUT=0x10000003,
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/GDI/Defines/DMMEDIA.cs:
--------------------------------------------------------------------------------
1 | namespace Win32
2 | {
3 | ///
4 | /// Specifies the type of media being printed on.
5 | ///
6 | public enum DMMEDIA : uint
7 | {
8 | ///
9 | /// Plain paper.
10 | ///
11 | STANDARD=1,
12 |
13 | ///
14 | /// Transparent film.
15 | ///
16 | TRANSPARENCY=2,
17 |
18 | ///
19 | /// Glossy paper.
20 | ///
21 | GLOSSY=3,
22 |
23 | ///
24 | /// Start of the user-defined media types.
25 | ///
26 | USER=256,
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/GDI/Defines/PRINTRATEUNIT.cs:
--------------------------------------------------------------------------------
1 | namespace Win32
2 | {
3 | ///
4 | /// Print rate units. Return value of
5 | ///
6 | public enum PRINTRATEUNIT : uint
7 | {
8 | ///
9 | /// Pages per minute.
10 | ///
11 | PPM=1,
12 |
13 | ///
14 | /// Characters per second.
15 | ///
16 | CPS=2,
17 |
18 | ///
19 | /// Lines per minute.
20 | ///
21 | LPM=3,
22 |
23 | ///
24 | /// Inches per minute.
25 | ///
26 | IPM=4,
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/GDI/Defines/DMDUP.cs:
--------------------------------------------------------------------------------
1 | namespace Win32
2 | {
3 | ///
4 | /// Selects duplex or double-sided printing for printers capable of duplex printing.
5 | ///
6 | public enum DMDUP : short
7 | {
8 | ///
9 | /// Normal (nonduplex) printing.
10 | ///
11 | SIMPLEX=1,
12 |
13 | ///
14 | /// Short-edge binding, that is, the long edge of the page is horizontal.
15 | ///
16 | HORIZONTAL=2,
17 |
18 | ///
19 | /// Long-edge binding, that is, the long edge of the page is vertical.
20 | ///
21 | VERTICAL=3,
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/GDI/Defines/VP_MODE.cs:
--------------------------------------------------------------------------------
1 | namespace Win32
2 | {
3 | ///
4 | /// Specifies the current playback mode.
5 | ///
6 | public enum VP_MODE : uint
7 | {
8 | ///
9 | /// Describes a set of display settings that are optimal for display on a Windows Embedded CE-based device, with the flicker filter on and any overscan display off.
10 | ///
11 | WIN_GRAPHICS=0x0001,
12 |
13 | ///
14 | /// Describes a set of display settings for video playback, with the flicker filter off and the overscan display on.
15 | ///
16 | TV_PLAYBACK=0x0002,
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/IO/RawInput/Defines/RIM_TYPE.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Win32.IO.RawInput
4 | {
5 | ///
6 | /// Defined the type of the raw input or the input device.
7 | ///
8 | [CLSCompliant(false)]
9 | public enum RIM_TYPE : uint
10 | {
11 | ///
12 | /// Raw input comes from the mouse.
13 | ///
14 | MOUSE=0,
15 |
16 | ///
17 | /// Raw input comes from the keyboard.
18 | ///
19 | KEYBOARD=1,
20 |
21 | ///
22 | /// Raw input comes from some device that is not a keyboard or a mouse.
23 | ///
24 | HID=2,
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/IO/RawInput/Structs/RAWINPUTDEVICELIST.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.InteropServices;
3 | using HANDLE=System.IntPtr;
4 |
5 | namespace Win32.IO.RawInput
6 | {
7 | ///
8 | /// Contains information about a raw input device.
9 | ///
10 | [StructLayout(LayoutKind.Sequential)]
11 | [CLSCompliant(false)]
12 | public struct RAWINPUTDEVICELIST
13 | {
14 | ///
15 | /// A handle to the raw input device.
16 | ///
17 | public HANDLE hDevice;
18 |
19 | ///
20 | /// The type of device.
21 | ///
22 | public RIM_TYPE dwType;
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/GDI/Defines/DMTT.cs:
--------------------------------------------------------------------------------
1 | namespace Win32
2 | {
3 | ///
4 | /// Specifies how TrueType fonts should be printed.
5 | ///
6 | public enum DMTT : uint
7 | {
8 | ///
9 | /// Print TT fonts as graphics.
10 | ///
11 | BITMAP=1,
12 |
13 | ///
14 | /// Download TT fonts as soft fonts.
15 | ///
16 | DOWNLOAD=2,
17 |
18 | ///
19 | /// Substitute device fonts for TT fonts.
20 | ///
21 | SUBDEV=3,
22 |
23 | ///
24 | /// Download TT fonts as outline soft fonts.
25 | ///
26 | DOWNLOAD_OUTLINE=4,
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/GDI/Defines/DMDFO.cs:
--------------------------------------------------------------------------------
1 | namespace Win32
2 | {
3 | ///
4 | /// For fixed-resolution display devices only, how the display presents a low-resolution mode on a higher-resolution display.
5 | ///
6 | public enum DMDFO : uint
7 | {
8 | ///
9 | /// The display's default setting.
10 | ///
11 | DEFAULT=0,
12 |
13 | ///
14 | /// The low-resolution image is stretched to fill the larger screen space.
15 | ///
16 | STRETCH=1,
17 |
18 | ///
19 | /// The low-resolution image is centered in the larger screen space.
20 | ///
21 | CENTER=2,
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/IO/RawInput/Defines/GIDC.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Win32.IO.RawInput
4 | {
5 | ///
6 | /// Defines the allowed values for the wParam parameter of a
7 | /// WM_INPUT_DEVICE_CHANGE message.
8 | /// To get the wParam value, use the .
9 | ///
10 | public enum GIDC
11 | {
12 | ///
13 | /// A new device has been added to the system.
14 | ///
15 | ARRIVAL=1,
16 |
17 | ///
18 | /// A device has been removed from the system.
19 | ///
20 | REMOVAL=2,
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/IO/Defines/FilePointerMoveMethod.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Win32.IO
4 | {
5 | ///
6 | /// Defines the starting points for the file pointer move operations.
7 | ///
8 | [CLSCompliant(false)]
9 | public enum FilePointerMoveMethod : uint
10 | {
11 | ///
12 | /// The starting point is zero or the beginning of the file.
13 | ///
14 | FILE_BEGIN=0,
15 |
16 | ///
17 | /// The starting point is the current value of the file pointer.
18 | ///
19 | FILE_CURRENT=1,
20 |
21 | ///
22 | /// The starting point is the current end-of-file position.
23 | ///
24 | FILE_END=2,
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/GDI/Defines/DisplaySettingsMode.cs:
--------------------------------------------------------------------------------
1 | namespace Win32
2 | {
3 | ///
4 | /// Specifies special mode numbers of DisplayMode.EnumDisplaySettings and
5 | /// DisplayMode.EnumDisplaySettingsEx.
6 | ///
7 | public enum DisplaySettingsMode : uint
8 | {
9 | ///
10 | /// Retrieve the current settings for the display device.
11 | ///
12 | ENUM_CURRENT_SETTINGS=0xFFFFFFFF,
13 |
14 | ///
15 | /// Retrieve the settings for the display device that are currently stored in the registry.
16 | ///
17 | ENUM_REGISTRY_SETTINGS=0xFFFFFFFE
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/GDI/Defines/DCTT.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Win32
4 | {
5 | ///
6 | /// Return value for .
7 | ///
8 | [Flags]
9 | public enum DCTT : uint
10 | {
11 | ///
12 | /// Device can print TrueType fonts as graphics.
13 | ///
14 | BITMAP=1,
15 |
16 | ///
17 | /// Device can download TrueType fonts.
18 | ///
19 | DOWNLOAD=2,
20 |
21 | ///
22 | /// Device can substitute device fonts for TrueType fonts.
23 | ///
24 | SUBDEV=4,
25 |
26 | ///
27 | /// (Windows 95/98/Me only) The device can download outline TrueType fonts.
28 | ///
29 | DOWNLOAD_OUTLINE=8,
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/WinKernel/Defines/GENERIC.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Win32
4 | {
5 | ///
6 | /// Generic Access Rights. See for more information.
7 | ///
8 | [CLSCompliant(false)]
9 | [Flags]
10 | public enum GENERIC : uint
11 | {
12 | ///
13 | /// Read access
14 | ///
15 | READ=ACCESS_MASK.GENERIC_READ,
16 |
17 | ///
18 | /// Write access
19 | ///
20 | WRITE=ACCESS_MASK.GENERIC_WRITE,
21 |
22 | ///
23 | /// Execute access
24 | ///
25 | EXECUTE=ACCESS_MASK.GENERIC_EXECUTE,
26 |
27 | ///
28 | /// All possible access rights
29 | ///
30 | ALL=ACCESS_MASK.GENERIC_ALL,
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/GDI/Defines/DMDISPLAYFLAGS.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Win32
4 | {
5 | ///
6 | /// Specifies the device's display mode.
7 | ///
8 | public enum DMDISPLAYFLAGS : uint
9 | {
10 | ///
11 | /// Specifies that the display is a noncolor device. If this flag is not set, color is assumed.
12 | ///
13 | [Obsolete("This flag is no longer valid.")]
14 | GRAYSCALE=0x00000001,
15 |
16 | ///
17 | /// Specifies that the display mode is interlaced. If the flag is not set, noninterlaced is assumed.
18 | ///
19 | INTERLACED=0x00000002,
20 |
21 | ///
22 | /// Specifies that the display mode is text. If the flag is not set, graphic is assumed.
23 | ///
24 | TEXTMODE=0x00000004,
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/WinDef/Size.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.InteropServices;
2 |
3 | namespace Win32
4 | {
5 | ///
6 | /// Defines the width and height of a rectangle.
7 | ///
8 | ///
9 | /// The rectangle dimensions stored in this structure may correspond to viewport extents, window extents,
10 | /// text extents, bitmap dimensions, or the aspect-ratio filter for some extended functions.
11 | ///
12 | [StructLayout(LayoutKind.Sequential)]
13 | public struct Size
14 | {
15 | ///
16 | /// Specifies the rectangle's width. The units depend on which function uses this.
17 | ///
18 | public int cx;
19 |
20 | ///
21 | /// Specifies the rectangle's height. The units depend on which function uses this.
22 | ///
23 | public int cy;
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/GDI/Defines/EDS.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Win32
4 | {
5 | ///
6 | /// Specifies flags for DisplayMode.EnumDisplaySettingsEx.
7 | ///
8 | [Flags]
9 | public enum EDS : uint
10 | {
11 | ///
12 | /// If set, the function will return all graphics modes reported by the adapter driver, regardless of monitor capabilities. Otherwise, it will only return modes that are compatible with current monitors.
13 | ///
14 | RAWMODE=0x00000002,
15 |
16 | ///
17 | /// If set, the function will return graphics modes in all orientations. Otherwise, it will only return modes that have the same orientation as the one currently set for the requested display.
18 | ///
19 | ROTATEDMODE=0x00000004,
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/GDI/Defines/DMICMMETHOD.cs:
--------------------------------------------------------------------------------
1 | namespace Win32
2 | {
3 | ///
4 | /// Specifies how ICM is handled. For a non-ICM application, this member determines if ICM is enabled or disabled.
5 | ///
6 | public enum DMICMMETHOD : uint
7 | {
8 | ///
9 | /// Specifies that ICM is disabled.
10 | ///
11 | NONE=1,
12 |
13 | ///
14 | /// Specifies that ICM is handled by Windows.
15 | ///
16 | SYSTEM=2,
17 |
18 | ///
19 | /// Specifies that ICM is handled by the device driver.
20 | ///
21 | DRIVER=3,
22 |
23 | ///
24 | /// Specifies that ICM is handled by the destination device.
25 | ///
26 | DEVICE=4,
27 |
28 | ///
29 | /// Start of the user-defined methods.
30 | ///
31 | USER=256,
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/IO/RawInput/Defines/RIM.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Win32.IO.RawInput
4 | {
5 | ///
6 | /// Defines the allowed values for the wParam parameter of a
7 | /// WM_INPUT message.
8 | /// To get the wParam value, use the .
9 | ///
10 | public enum RIM
11 | {
12 | ///
13 | /// The input is in the regular message flow, the app is required to call
14 | /// DefWindowProc so that the system can perform clean ups.
15 | ///
16 | INPUT=0,
17 |
18 | ///
19 | /// The input is sink only. The app is expected to behave nicely and the
20 | /// app is required to call DefWindowProc so that the system can
21 | /// perform clean ups.
22 | ///
23 | INPUTSINK=1,
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | Win32
2 | =====
3 |
4 | Win32 API wrapper for .NET and Mono written in C#
5 |
6 | Contains static classes, enums and structures wrapping Win32 API calls.
7 | * DeviceContext: Class containing functions of the GDI relevant for OpenGL initialization.
8 | * DisplayMode: Class for managing display modes.
9 | * Monitor: Class for managing monitor devices.
10 | * Windows: Class for managing windows (not the OS, just the windows).
11 | * Font: Class for handling fonts.
12 | * GDI: Wrapper for GDI API calls.
13 | * IO: Namespace for I/O operations (incl. classes for file and file system operations).
14 | * IO.RawInput: Namespace for Raw Input API operations (class RawInput), enums and structures.
15 | * IO.HumanInterfaceDevices: Namespace for HID.
16 |
17 |
18 | **Authors**
19 |
20 | Copyright (c) of C# port 2014-2015 by Shinta ()
21 |
--------------------------------------------------------------------------------
/IO/Defines/FileMode.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Win32.IO
4 | {
5 | ///
6 | /// Defines the file opening or creation actions.
7 | ///
8 | [CLSCompliant(false)]
9 | public enum FileMode : uint
10 | {
11 | ///
12 | /// Creates a new file, only if it does not already exist.
13 | ///
14 | CREATE_NEW=1,
15 |
16 | ///
17 | /// Creates a new file, always.
18 | ///
19 | CREATE_ALWAYS=2,
20 |
21 | ///
22 | /// Opens a file or device, only if it exists.
23 | ///
24 | OPEN_EXISTING=3,
25 |
26 | ///
27 | /// Opens a file, always.
28 | ///
29 | OPEN_ALWAYS=4,
30 |
31 | ///
32 | /// Opens a file and truncates it so that its size is zero bytes, only if it exists.
33 | ///
34 | TRUNCATE_EXISTING=5,
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/GDI/Defines/DMDO.cs:
--------------------------------------------------------------------------------
1 | namespace Win32
2 | {
3 | ///
4 | /// For display devices only, the orientation at which images should be presented.
5 | ///
6 | public enum DMDO : uint
7 | {
8 | ///
9 | /// The display orientation is the natural orientation of the display device; it should be used as the default.
10 | ///
11 | DEFAULT=0,
12 |
13 | ///
14 | /// The display orientation is rotated 90 degrees (measured clockwise) from .
15 | ///
16 | _90=1,
17 |
18 | ///
19 | /// The display orientation is rotated 180 degrees (measured clockwise) from .
20 | ///
21 | _180=2,
22 |
23 | ///
24 | /// The display orientation is rotated 270 degrees (measured clockwise) from .
25 | ///
26 | _270=3,
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/IO/Defines/FILE_SHARE.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Win32.IO
4 | {
5 | ///
6 | /// Defines the file access flags used by some file functions.
7 | ///
8 | [CLSCompliant(false)]
9 | [Flags]
10 | public enum FILE_SHARE : uint
11 | {
12 | ///
13 | /// Prevents other processes from opening a file or device if they request delete, read, or write access.
14 | ///
15 | NONE=0,
16 |
17 | ///
18 | /// Enables subsequent open operations on a file or device to request read access.
19 | ///
20 | READ=0x00000001,
21 |
22 | ///
23 | /// Enables subsequent open operations on a file or device to request write access.
24 | ///
25 | WRITE=0x00000002,
26 |
27 | ///
28 | /// Enables subsequent open operations on a file or device to request delete access.
29 | ///
30 | DELETE=0x00000004,
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/IO/RawInput/Defines/RI_KEY.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Win32.IO.RawInput
4 | {
5 | ///
6 | /// Defines flags for scan code information.
7 | ///
8 | [CLSCompliant(false)]
9 | [Flags]
10 | public enum RI_KEY : ushort
11 | {
12 | ///
13 | /// The key is down.
14 | ///
15 | MAKE=0,
16 |
17 | ///
18 | /// The key is up.
19 | ///
20 | BREAK=1,
21 |
22 | ///
23 | /// This is the left version of the key.
24 | ///
25 | E0=2,
26 |
27 | ///
28 | /// This is the right version of the key.
29 | ///
30 | E1=4,
31 |
32 | ///
33 | /// [Please fill, if someone knows what this value does.]
34 | ///
35 | TERMSRV_SET_LED=8,
36 |
37 | ///
38 | /// [Please fill, if someone knows what this value does.]
39 | ///
40 | TERMSRV_SHADOW=0x10,
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/WinKernel/Defines/SECURITY_IMPERSONATION_LEVEL.cs:
--------------------------------------------------------------------------------
1 | namespace Win32
2 | {
3 | ///
4 | /// Defines the impersonation levels that determine the operations a server can perform in the client's context.
5 | ///
6 | public enum SECURITY_IMPERSONATION_LEVEL
7 | {
8 | ///
9 | /// The server cannot impersonate or identify the client.
10 | ///
11 | SecurityAnonymous=0,
12 |
13 | ///
14 | /// The server can get the identity and privileges of the client, but cannot impersonate the client.
15 | ///
16 | SecurityIdentification=1,
17 |
18 | ///
19 | /// The server can impersonate the client's security context on the local system.
20 | ///
21 | SecurityImpersonation=2,
22 |
23 | ///
24 | /// The server can impersonate the client's security context on remote systems.
25 | ///
26 | SecurityDelegation=3,
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/WinKernel/Defines/ERROR.cs:
--------------------------------------------------------------------------------
1 | namespace Win32
2 | {
3 | ///
4 | /// Windows errors.
5 | ///
6 | public static class ERROR
7 | {
8 | ///
9 | /// No error.
10 | ///
11 | public const int NO_ERROR=0x0000;
12 |
13 | ///
14 | /// Access is denied.
15 | ///
16 | public const int ACCESS_DENIED=0x0005;
17 |
18 | ///
19 | /// The data area passed to a system call is too small.
20 | ///
21 | public const int INSUFFICIENT_BUFFER=0x007A;
22 |
23 | ///
24 | /// The operation did not complete successfully because it would cause an oplock
25 | /// to be broken. The caller has requested that existing oplocks not be broken.
26 | ///
27 | public const int CANNOT_BREAK_OPLOCK=0x0322;
28 |
29 | ///
30 | /// Overlapped I/O operation is in progress.
31 | ///
32 | public const int IO_PENDING=0x03E5;
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/IO/RawInput/Defines/MOUSE.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Win32.IO.RawInput
4 | {
5 | ///
6 | /// Defines the mouse state.
7 | ///
8 | [CLSCompliant(false)]
9 | [Flags]
10 | public enum MOUSE : ushort
11 | {
12 | ///
13 | /// Mouse movement data is relative to the last mouse position.
14 | ///
15 | MOVE_RELATIVE=0x00,
16 |
17 | ///
18 | /// Mouse movement data is based on absolute position.
19 | ///
20 | MOVE_ABSOLUTE=0x01,
21 |
22 | ///
23 | /// Mouse coordinates are mapped to the virtual desktop (for a multiple monitor system).
24 | ///
25 | VIRTUAL_DESKTOP=0x02,
26 |
27 | ///
28 | /// Mouse attributes changed; application needs to query the mouse attributes.
29 | ///
30 | ATTRIBUTES_CHANGED=0x04,
31 |
32 | ///
33 | /// Do not coalesce mouse moves.
34 | ///
35 | MOVE_NOCOALESCE=0x08,
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/WinKernel/Structs/GENERIC_MAPPING.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.InteropServices;
3 |
4 | namespace Win32
5 | {
6 | ///
7 | /// Specifies an access mask defining all the generic access types to an object.
8 | ///
9 | [StructLayout(LayoutKind.Sequential)]
10 | public struct GENERIC_MAPPING
11 | {
12 | ///
13 | /// Specifies an access mask defining read access to an object.
14 | ///
15 | public ACCESS_MASK GenericRead;
16 |
17 | ///
18 | /// Specifies an access mask defining write access to an object.
19 | ///
20 | public ACCESS_MASK GenericWrite;
21 |
22 | ///
23 | /// Specifies an access mask defining execute access to an object.
24 | ///
25 | public ACCESS_MASK GenericExecute;
26 |
27 | ///
28 | /// Specifies an access mask defining all possible types of access to an object.
29 | ///
30 | public ACCESS_MASK GenericAll;
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/IO/RawInput/Structs/RID_DEVICE_INFO_HID.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.InteropServices;
3 |
4 | namespace Win32.IO.RawInput
5 | {
6 | ///
7 | /// Defines the raw input data coming from the specified Human Interface Device (HID).
8 | ///
9 | [StructLayout(LayoutKind.Sequential)]
10 | [CLSCompliant(false)]
11 | public struct RID_DEVICE_INFO_HID
12 | {
13 | ///
14 | /// The vendor identifier for the HID.
15 | ///
16 | public uint dwVendorId;
17 |
18 | ///
19 | /// The product identifier for the HID.
20 | ///
21 | public uint dwProductId;
22 |
23 | ///
24 | /// The version number for the HID.
25 | ///
26 | public uint dwVersionNumber;
27 |
28 | ///
29 | /// The top-level collection Usage Page for the device.
30 | ///
31 | public ushort usUsagePage;
32 |
33 | ///
34 | /// The top-level collection Usage for the device.
35 | ///
36 | public ushort usUsage;
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/WinKernel/Defines/STANDARD_RIGHTS.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Win32
4 | {
5 | ///
6 | /// Standard Access Rights. See for more information.
7 | ///
8 | [CLSCompliant(false)]
9 | [Flags]
10 | public enum STANDARD_RIGHTS : uint
11 | {
12 | ///
13 | /// See .
14 | ///
15 | REQUIRED=ACCESS_MASK.STANDARD_RIGHTS_REQUIRED,
16 |
17 | ///
18 | /// See .
19 | ///
20 | READ=ACCESS_MASK.STANDARD_RIGHTS_READ,
21 |
22 | ///
23 | /// See .
24 | ///
25 | WRITE=ACCESS_MASK.STANDARD_RIGHTS_WRITE,
26 |
27 | ///
28 | /// See .
29 | ///
30 | EXECUTE=ACCESS_MASK.STANDARD_RIGHTS_EXECUTE,
31 |
32 | ///
33 | /// See .
34 | ///
35 | ALL=ACCESS_MASK.STANDARD_RIGHTS_ALL,
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy
4 | of this software and associated documentation files (the "Software"), to deal
5 | in the Software without restriction, including without limitation the rights
6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | copies of the Software, and to permit persons to whom the Software is
8 | furnished to do so, subject to the following conditions:
9 |
10 | The above copyright notice and this permission notice shall be included in all
11 | copies or substantial portions of the Software.
12 |
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | SOFTWARE.
20 |
21 |
--------------------------------------------------------------------------------
/Monitor/Structs/MonitorInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.InteropServices;
2 |
3 | namespace Win32
4 | {
5 | ///
6 | /// Structure containing information about a display monitor.
7 | ///
8 | [StructLayout(LayoutKind.Explicit)]
9 | public struct MonitorInfo
10 | {
11 | ///
12 | /// The size, in bytes, of the structure.
13 | ///
14 | [FieldOffset(0)]
15 | public uint cbSize;
16 |
17 | ///
18 | /// A structure that specifies the display monitor rectangle, expressed in virtual-screen coordinates.
19 | ///
20 | [FieldOffset(4)]
21 | public Rect rcMonitor;
22 |
23 | ///
24 | /// A structure that specifies the work area rectangle of the display monitor that can be used by applications, expressed in virtual-screen coordinates.
25 | ///
26 | [FieldOffset(20)]
27 | public Rect rcWork;
28 |
29 | ///
30 | /// A set of flags that represent attributes of the display monitor.
31 | ///
32 | [FieldOffset(36)]
33 | public MonitorInfoFlag dwFlags;
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/IO/Defines/FILE_ACTION.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Win32.IO
4 | {
5 | ///
6 | /// Defined the type of change that can occur in directories.
7 | ///
8 | [CLSCompliant(false)]
9 | public enum FILE_ACTION : uint
10 | {
11 | ///
12 | /// A file was added to the directory.
13 | ///
14 | ADDED=0x00000001,
15 |
16 | ///
17 | /// A file was removed from the directory.
18 | ///
19 | REMOVED=0x00000002,
20 |
21 | ///
22 | /// A file was modified. This can be a change in the time stamp or attributes.
23 | ///
24 | MODIFIED=0x00000003,
25 |
26 | ///
27 | /// The file was renamed, since an action notification report carries only one
28 | /// file name, two reports transport the information. This is the old name.
29 | ///
30 | RENAMED_OLD_NAME=0x00000004,
31 |
32 | ///
33 | /// The file was renamed, since an action notification report carries only one
34 | /// file name, two reports transport the information. This is the new name.
35 | ///
36 | RENAMED_NEW_NAME=0x00000005,
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/WinKernel/Structs/SECURITY_ATTRIBUTES.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.InteropServices;
3 |
4 | namespace Win32
5 | {
6 | ///
7 | /// Contains the security descriptor for an object and specifies whether the handle
8 | /// retrieved by specifying this structure is inheritable.
9 | ///
10 | [StructLayout(LayoutKind.Sequential)]
11 | public struct SECURITY_ATTRIBUTES
12 | {
13 | ///
14 | /// The size, in bytes, of this structure. Set this value to the size of the
15 | /// structure.
16 | ///
17 | public uint nLength;
18 |
19 | ///
20 | /// A pointer to a SECURITY_DESCRIPTOR structure that controls access
21 | /// to the object. Default security descriptor is null (IntPtr.Zero).
22 | ///
23 | public IntPtr lpSecurityDescriptor;
24 |
25 | ///
26 | /// A bool value that specifies whether the returned handle is
27 | /// inherited when a new process is created. If this member is true,
28 | /// the new process inherits the handle.
29 | ///
30 | public bool bInheritHandle;
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/GDI/Defines/QUALITY.cs:
--------------------------------------------------------------------------------
1 | namespace Win32
2 | {
3 | ///
4 | /// The output quality.
5 | ///
6 | public enum QUALITY : uint
7 | {
8 | ///
9 | /// Appearance of the font does not matter.
10 | ///
11 | DEFAULT=0,
12 |
13 | ///
14 | /// Appearance of the font is less important than when the value is used.
15 | ///
16 | DRAFT=1,
17 |
18 | ///
19 | /// Character quality of the font is more important than exact matching of the logical-font attributes.
20 | ///
21 | PROOF=2,
22 |
23 | ///
24 | /// Font is never antialiased, that is, font smoothing is not done.
25 | ///
26 | NONANTIALIASED=3,
27 |
28 | ///
29 | /// Font is antialiased, or smoothed, if the font supports it and the size of the font is not too small or too large.
30 | ///
31 | ANTIALIASED=4,
32 |
33 | ///
34 | /// If set, text is rendered (when possible) using ClearType antialiasing method.
35 | ///
36 | CLEARTYPE=5,
37 |
38 | ///
39 | /// ?
40 | ///
41 | CLEARTYPE_NATURAL=6,
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/GDI/Defines/LogFontQuality.cs:
--------------------------------------------------------------------------------
1 | namespace Win32
2 | {
3 | ///
4 | /// The output quality.
5 | ///
6 | public enum LogFontQuality : byte
7 | {
8 | ///
9 | /// Appearance of the font does not matter.
10 | ///
11 | DEFAULT=0,
12 |
13 | ///
14 | /// Appearance of the font is less important than when the value is used.
15 | ///
16 | DRAFT=1,
17 |
18 | ///
19 | /// Character quality of the font is more important than exact matching of the logical-font attributes.
20 | ///
21 | PROOF=2,
22 |
23 | ///
24 | /// Font is never antialiased, that is, font smoothing is not done.
25 | ///
26 | NONANTIALIASED=3,
27 |
28 | ///
29 | /// Font is antialiased, or smoothed, if the font supports it and the size of the font is not too small or too large.
30 | ///
31 | ANTIALIASED=4,
32 |
33 | ///
34 | /// If set, text is rendered (when possible) using ClearType antialiasing method.
35 | ///
36 | CLEARTYPE=5,
37 |
38 | ///
39 | /// ?
40 | ///
41 | CLEARTYPE_NATURAL=6,
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/IO/RawInput/Defines/RIDI.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Win32.IO.RawInput
4 | {
5 | ///
6 | /// Defines the command flag for .
7 | ///
8 | [CLSCompliant(false)]
9 | public enum RIDI : uint
10 | {
11 | ///
12 | /// pData parameter of points to a string
13 | /// that contains the device name.
14 | /// For this uiCommand only, the value in pcbSize of
15 | /// is the character count (not the byte count).
16 | ///
17 | DEVICENAME=0x20000007,
18 |
19 | ///
20 | /// pData parameter of points to an
21 | /// structure.
22 | ///
23 | DEVICEINFO=0x2000000b,
24 |
25 | ///
26 | /// pData parameter of points to the previously
27 | /// parsed data.
28 | ///
29 | PREPARSEDDATA=0x20000005,
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/IO/RawInput/Structs/RID_DEVICE_INFO_MOUSE.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.InteropServices;
3 |
4 | namespace Win32.IO.RawInput
5 | {
6 | ///
7 | /// Defines the raw input data coming from the specified mouse.
8 | ///
9 | /// For the mouse, the Usage Page is 1 and the Usage is 2.
10 | [StructLayout(LayoutKind.Sequential)]
11 | [CLSCompliant(false)]
12 | public struct RID_DEVICE_INFO_MOUSE
13 | {
14 | ///
15 | /// The identifier of the mouse device.
16 | ///
17 | public uint dwId;
18 |
19 | ///
20 | /// The number of buttons for the mouse.
21 | ///
22 | public uint dwNumberOfButtons;
23 |
24 | ///
25 | /// The number of data points per second. This information may not be applicable for every mouse device.
26 | ///
27 | public uint dwSampleRate;
28 |
29 | ///
30 | /// true if the mouse has a wheel for horizontal scrolling; otherwise, false.
31 | /// Windows XP: This member is only supported starting with Windows Vista.
32 | ///
33 | [MarshalAs(UnmanagedType.Bool)]
34 | public bool fHasHorizontalWheel;
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/IO/RawInput/Structs/RID_DEVICE_INFO_KEYBOARD.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.InteropServices;
3 |
4 | namespace Win32.IO.RawInput
5 | {
6 | ///
7 | /// Defines the raw input data coming from the specified keyboard.
8 | ///
9 | /// For the keyboard, the Usage Page is 1 and the Usage is 6.
10 | [StructLayout(LayoutKind.Sequential)]
11 | [CLSCompliant(false)]
12 | public struct RID_DEVICE_INFO_KEYBOARD
13 | {
14 | ///
15 | /// The type of the keyboard.
16 | ///
17 | public uint dwType;
18 |
19 | ///
20 | /// The subtype of the keyboard.
21 | ///
22 | public uint dwSubType;
23 |
24 | ///
25 | /// The scan code mode.
26 | ///
27 | public uint dwKeyboardMode;
28 |
29 | ///
30 | /// The number of function keys on the keyboard.
31 | ///
32 | public uint dwNumberOfFunctionKeys;
33 |
34 | ///
35 | /// The number of LED indicators on the keyboard.
36 | ///
37 | public uint dwNumberOfIndicators;
38 |
39 | ///
40 | /// The total number of keys on the keyboard.
41 | ///
42 | public uint dwNumberOfKeysTotal;
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Reflection;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("Win32")]
9 | [assembly: AssemblyDescription("Wrapper for Win32 API calls for use in .NET-Framework based applications.")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("Win32")]
13 | [assembly: AssemblyCopyright("Copyright © 2014-2015 by the Authors")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("7557AE2C-7195-486D-B873-7F0D82B2626A")]
24 |
25 | // The following line set the CLS compliance of the assembly.
26 | [assembly: CLSCompliant(false)]
27 |
--------------------------------------------------------------------------------
/GDI/Defines/DMDITHER.cs:
--------------------------------------------------------------------------------
1 | namespace Win32
2 | {
3 | ///
4 | /// Specifies how dithering is to be done.
5 | ///
6 | public enum DMDITHER : uint
7 | {
8 | ///
9 | /// No dithering
10 | ///
11 | NONE=1,
12 |
13 | ///
14 | /// Dither with a coarse brush
15 | ///
16 | COARSE=2,
17 |
18 | ///
19 | /// Dither with a fine brush
20 | ///
21 | FINE=3,
22 |
23 | ///
24 | /// LineArt dithering
25 | ///
26 | LINEART=4,
27 |
28 | ///
29 | /// LineArt dithering
30 | ///
31 | ERRORDIFFUSION=5,
32 |
33 | ///
34 | /// LineArt dithering
35 | ///
36 | RESERVED6=6,
37 |
38 | ///
39 | /// LineArt dithering
40 | ///
41 | RESERVED7=7,
42 |
43 | ///
44 | /// LineArt dithering
45 | ///
46 | RESERVED8=8,
47 |
48 | ///
49 | /// LineArt dithering
50 | ///
51 | RESERVED9=9,
52 |
53 | ///
54 | /// Device does grayscaling
55 | ///
56 | GRAYSCALE=10,
57 |
58 | ///
59 | /// Start of the user-defined dithers.
60 | ///
61 | USER=256,
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/GDI/Defines/DMICM.cs:
--------------------------------------------------------------------------------
1 | namespace Win32
2 | {
3 | ///
4 | /// Specifies which color matching method, or intent, should be used by default.
5 | ///
6 | public enum DMICM : uint
7 | {
8 | ///
9 | /// Color matching should optimize for color saturation. This value is the most appropriate choice for business graphs when dithering is not desired.
10 | ///
11 | SATURATE=1,
12 |
13 | ///
14 | /// Color matching should optimize for color contrast. This value is the most appropriate choice for scanned or photographic images when dithering is desired.
15 | ///
16 | CONTRAST=2,
17 |
18 | ///
19 | /// Color matching should optimize to match the exact color requested. This value is most appropriate for use with business logos or other images when an exact color match is desired.
20 | ///
21 | COLORIMETRIC=3,
22 |
23 | ///
24 | /// Color matching should optimize to match the exact color requested without white point mapping. This value is most appropriate for use with proofing.
25 | ///
26 | ABS_COLORIMETRIC=4,
27 |
28 | ///
29 | /// Start of the user-defined color matching methods.
30 | ///
31 | USER=256,
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/GDI/Defines/DISP_CHANGE.cs:
--------------------------------------------------------------------------------
1 | namespace Win32
2 | {
3 | ///
4 | /// Specifies return values for DisplayMode.ChangeDisplaySettings.
5 | ///
6 | public enum DISP_CHANGE : int
7 | {
8 | ///
9 | /// The settings change was successful.
10 | ///
11 | SUCCESSFUL=0,
12 |
13 | ///
14 | /// The computer must be restarted for the graphics mode to work.
15 | ///
16 | RESTART=1,
17 |
18 | ///
19 | /// The display driver failed the specified graphics mode.
20 | ///
21 | FAILED=-1,
22 |
23 | ///
24 | /// The graphics mode is not supported.
25 | ///
26 | BADMODE=-2,
27 |
28 | ///
29 | /// Unable to write settings to the registry.
30 | ///
31 | NOTUPDATED=-3,
32 |
33 | ///
34 | /// An invalid set of flags was passed in.
35 | ///
36 | BADFLAGS=-4,
37 |
38 | ///
39 | /// An invalid parameter was passed in. This can include an invalid flag or combination of flags.
40 | ///
41 | BADPARAM=-5,
42 |
43 | ///
44 | /// The settings change was unsuccessful because the system is DualView capable.
45 | ///
46 | BADDUALVIEW=-6,
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/IO/Defines/FILE_NOTIFY_CHANGE.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Win32.IO
4 | {
5 | ///
6 | /// Defines filters for directory change notification.
7 | ///
8 | [CLSCompliant(false)]
9 | [Flags]
10 | public enum FILE_NOTIFY_CHANGE : uint
11 | {
12 | ///
13 | /// Return on any file name change, or on creating or deleting of a file.
14 | ///
15 | FILE_NAME=0x00000001,
16 |
17 | ///
18 | /// Return on any directory name change, or on creating or deleting of a directory.
19 | ///
20 | DIR_NAME=0x00000002,
21 |
22 | ///
23 | /// Return on any attribute change.
24 | ///
25 | ATTRIBUTES=0x00000004,
26 |
27 | ///
28 | /// Return on any size change.
29 | ///
30 | SIZE=0x00000008,
31 |
32 | ///
33 | /// Return on any change on the last write time of a file.
34 | ///
35 | LAST_WRITE=0x00000010,
36 |
37 | ///
38 | /// Return on any change on the last access time of a file.
39 | ///
40 | LAST_ACCESS=0x00000020,
41 |
42 | ///
43 | /// Return on any change on the creation time of a file.
44 | ///
45 | CREATION=0x00000040,
46 |
47 | ///
48 | /// Return on any change on the security-descriptor in the watch directory.
49 | ///
50 | SECURITY=0x00000100,
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/IO/RawInput/Structs/RAWINPUT.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.InteropServices;
3 |
4 | namespace Win32.IO.RawInput
5 | {
6 | ///
7 | /// Contains the raw input from a device.
8 | ///
9 | [StructLayout(LayoutKind.Sequential)]
10 | [CLSCompliant(false)]
11 | public struct RAWINPUT
12 | {
13 | #region Union of RAWMOUSE, RAWKEYBOARD and RAWHID.
14 | ///
15 | /// Union of , and .
16 | ///
17 | [StructLayout(LayoutKind.Explicit)]
18 | [CLSCompliant(false)]
19 | public struct DATA
20 | {
21 | ///
22 | /// If the data comes from a mouse, this is the raw input data.
23 | ///
24 | [FieldOffset(0)]
25 | public RAWMOUSE mouse;
26 |
27 | ///
28 | /// If the data comes from a keyboard, this is the raw input data.
29 | ///
30 | [FieldOffset(0)]
31 | public RAWKEYBOARD keyboard;
32 |
33 | ///
34 | /// If the data comes from an HID, this is the raw input data.
35 | ///
36 | [FieldOffset(0)]
37 | public RAWHID hid;
38 | }
39 | #endregion
40 |
41 | ///
42 | /// The raw input data header.
43 | ///
44 | public RAWINPUTHEADER header;
45 |
46 | ///
47 | /// The raw input data.
48 | ///
49 | public DATA data;
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/GDI/Structs/GlyphMetrics.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.InteropServices;
2 |
3 | namespace Win32
4 | {
5 | ///
6 | /// The GlyphMetrics structure contains information about the placement and orientation of a glyph in a character cell.
7 | ///
8 | ///
9 | /// Values in the GlyphMetrics structure are specified in device units.
10 | ///
11 | [StructLayout(LayoutKind.Sequential, Pack=1)]
12 | public struct GlyphMetrics
13 | {
14 | ///
15 | /// The width of the smallest rectangle that completely encloses the glyph (its black box).
16 | ///
17 | public uint gmBlackBoxX;
18 |
19 | ///
20 | /// The height of the smallest rectangle that completely encloses the glyph (its black box).
21 | ///
22 | public uint gmBlackBoxY;
23 |
24 | ///
25 | /// The x- and y-coordinates of the upper left corner of the smallest rectangle that completely encloses the glyph.
26 | ///
27 | public Point gmptGlyphOrigin;
28 |
29 | ///
30 | /// The horizontal distance from the origin of the current character cell to the origin of the next character cell.
31 | ///
32 | public short gmCellIncX;
33 |
34 | ///
35 | /// The vertical distance from the origin of the current character cell to the origin of the next character cell.
36 | ///
37 | public short gmCellIncY;
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/IO/RawInput/Structs/RAWHID.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.InteropServices;
3 |
4 | namespace Win32.IO.RawInput
5 | {
6 | ///
7 | /// Describes the format of the raw input from a Human Interface Device (HID).
8 | ///
9 | ///
10 | /// Each WM_INPUT can indicate several inputs, but all of the
11 | /// inputs come from the same HID. The size of the raw data array is
12 | /// *.
13 | ///
14 | [StructLayout(LayoutKind.Sequential)]
15 | [CLSCompliant(false)]
16 | public struct RAWHID
17 | {
18 | ///
19 | /// The size, in bytes, of each HID input in the raw data array that follows this structure.
20 | ///
21 | public uint dwSizeHid;
22 |
23 | ///
24 | /// The number of HID inputs in the raw data array that follows this structure.
25 | ///
26 | public uint dwCount;
27 |
28 | ///
29 | /// Here the raw data array starts. But since we can't define structs with variable length,
30 | /// you'll have to access the raw data array directly.
31 | /// Here only the first byte is available.
32 | ///
33 | //public unsafe fixed byte rawData[1];
34 | public byte bRawData;
35 |
36 | ///
37 | /// Size of in bytes.
38 | ///
39 | public static readonly uint SIZE=(uint)Marshal.SizeOf(typeof(RAWHID));
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/IO/RawInput/Structs/RID_DEVICE_INFO.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.InteropServices;
3 |
4 | namespace Win32.IO.RawInput
5 | {
6 | ///
7 | /// Defines the raw input data coming from any device.
8 | ///
9 | [StructLayout(LayoutKind.Explicit)]
10 | [CLSCompliant(false)]
11 | public struct RID_DEVICE_INFO
12 | {
13 | ///
14 | /// The size, in bytes, of the structure.
15 | ///
16 | [FieldOffset(0)]
17 | public uint cbSize;
18 |
19 | ///
20 | /// The type of raw input data.
21 | ///
22 | [FieldOffset(4)]
23 | public RIM_TYPE dwType;
24 |
25 | ///
26 | /// If is , this is the
27 | /// structure that defines the mouse.
28 | ///
29 | [FieldOffset(8)]
30 | public RID_DEVICE_INFO_MOUSE mouse;
31 |
32 | ///
33 | /// If is , this is the
34 | /// structure that defines the keyboard.
35 | ///
36 | [FieldOffset(8)]
37 | public RID_DEVICE_INFO_KEYBOARD keyboard;
38 |
39 | ///
40 | /// If is , this is the
41 | /// structure that defines the HID device.
42 | ///
43 | [FieldOffset(8)]
44 | public RID_DEVICE_INFO_HID hid;
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/WinDef/Rect.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.InteropServices;
2 |
3 | namespace Win32
4 | {
5 | ///
6 | /// Defines the coordinates of the upper-left and lower-right corners of a rectangle.
7 | ///
8 | [StructLayout(LayoutKind.Sequential)]
9 | public struct Rect
10 | {
11 | ///
12 | /// The x-coordinate of the upper-left corner of the rectangle.
13 | ///
14 | public int left;
15 |
16 | ///
17 | /// The y-coordinate of the upper-left corner of the rectangle.
18 | ///
19 | public int top;
20 |
21 | ///
22 | /// The x-coordinate of the lower-right corner of the rectangle.
23 | ///
24 | public int right;
25 |
26 | ///
27 | /// The y-coordinate of the lower-right corner of the rectangle.
28 | ///
29 | public int bottom;
30 |
31 | ///
32 | /// Constructor.
33 | ///
34 | /// The x-coordinate of the upper-left corner of the rectangle.
35 | /// The y-coordinate of the upper-left corner of the rectangle.
36 | /// The x-coordinate of the lower-right corner of the rectangle.
37 | /// The y-coordinate of the lower-right corner of the rectangle.
38 | public Rect(int left, int top, int right, int bottom)
39 | {
40 | this.left=left;
41 | this.top=top;
42 | this.right=right;
43 | this.bottom=bottom;
44 | }
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/IO/Defines/FILE_GENERIC.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Win32.IO
4 | {
5 | ///
6 | /// Defines how the generic access right for files and directories are made up,
7 | /// using specific and standard access rights. Use either these values or
8 | /// GENERIC.* or
9 | /// ACCESS_MASK.GENERIC_*. See for more information.
10 | ///
11 | [CLSCompliant(false)]
12 | [Flags]
13 | public enum FILE_GENERIC : uint
14 | {
15 | ///
16 | /// Collects the specific and standard access rights, that are set for GENERIC_READ.
17 | ///
18 | FILE_GENERIC_READ=STANDARD_RIGHTS.READ|FileAccess.FILE_READ_DATA|FileAccess.FILE_READ_ATTRIBUTES|FileAccess.FILE_READ_EA|ACCESS_MASK.SYNCHRONIZE,
19 |
20 | ///
21 | /// Collects the specific and standard access rights, that are set for GENERIC_WRITE.
22 | ///
23 | FILE_GENERIC_WRITE=STANDARD_RIGHTS.WRITE|FileAccess.FILE_WRITE_DATA|FileAccess.FILE_WRITE_ATTRIBUTES|FileAccess.FILE_WRITE_EA|FileAccess.FILE_APPEND_DATA|ACCESS_MASK.SYNCHRONIZE,
24 |
25 | ///
26 | /// Collects the specific and standard access rights, that are set for GENERIC_EXECUTE.
27 | ///
28 | FILE_GENERIC_EXECUTE=STANDARD_RIGHTS.EXECUTE|FileAccess.FILE_READ_ATTRIBUTES|FileAccess.FILE_EXECUTE|ACCESS_MASK.SYNCHRONIZE,
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/GDI/Defines/CLIP_PRECIS.cs:
--------------------------------------------------------------------------------
1 | namespace Win32
2 | {
3 | ///
4 | /// The clipping precision.
5 | ///
6 | public enum CLIP_PRECIS : uint
7 | {
8 | ///
9 | /// Specifies default clipping behavior.
10 | ///
11 | DEFAULT=0,
12 |
13 | ///
14 | /// Not used.
15 | ///
16 | CHARACTER=1,
17 |
18 | ///
19 | /// Not used by the font mapper, but is returned when raster, vector, or TrueType fonts are enumerated.
20 | ///
21 | STROKE=2,
22 |
23 | ///
24 | /// Not used.
25 | ///
26 | MASK=0xf,
27 |
28 | ///
29 | /// When this value is used, the rotation for all fonts depends on whether the orientation of the coordinate system is left-handed or right-handed.
30 | /// If not used, device fonts always rotate counterclockwise, but the rotation of other fonts is dependent on the orientation of the coordinate system.
31 | ///
32 | LH_ANGLES=(1<<4),
33 |
34 | ///
35 | /// Not used.
36 | ///
37 | TT_ALWAYS=(2<<4),
38 |
39 | ///
40 | /// Windows XP SP1: Turns off font association for the font. Note that this flag is not guaranteed to have any effect on any platform after Windows Server 2003.
41 | ///
42 | DFA_DISABLE=(4<<4),
43 |
44 | ///
45 | /// You must specify this flag to use an embedded read-only font.
46 | ///
47 | EMBEDDED=(8<<4),
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/IO/RawInput/Structs/RAWINPUTHEADER.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.InteropServices;
3 | using HANDLE=System.IntPtr;
4 | using WPARAM=System.UIntPtr;
5 |
6 | namespace Win32.IO.RawInput
7 | {
8 | ///
9 | /// Contains the header information that is part of the raw input data.
10 | ///
11 | /// To get more information on the device, use in a call to
12 | /// .
13 | [StructLayout(LayoutKind.Sequential)]
14 | [CLSCompliant(false)]
15 | public struct RAWINPUTHEADER
16 | {
17 | ///
18 | /// The type of raw input.
19 | ///
20 | public RIM_TYPE dwType;
21 |
22 | ///
23 | /// The size, in bytes, of the entire input packet of data. This includes
24 | /// plus possible extra input reports in the variable length array.
25 | ///
26 | public uint dwSize;
27 |
28 | ///
29 | /// A handle to the device generating the raw input data.
30 | ///
31 | public HANDLE hDevice;
32 |
33 | ///
34 | /// The value passed in the wParam parameter of the WM_INPUT message.
35 | ///
36 | public WPARAM wParam;
37 |
38 | ///
39 | /// Size of in bytes.
40 | ///
41 | public static readonly uint SIZE=(uint)Marshal.SizeOf(typeof(RAWINPUTHEADER));
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/GDI/Defines/LogFontClipPrecision.cs:
--------------------------------------------------------------------------------
1 | namespace Win32
2 | {
3 | ///
4 | /// The clipping precision.
5 | ///
6 | public enum LogFontClipPrecision : byte
7 | {
8 | ///
9 | /// Specifies default clipping behavior.
10 | ///
11 | DEFAULT=0,
12 |
13 | ///
14 | /// Not used.
15 | ///
16 | CHARACTER=1,
17 |
18 | ///
19 | /// Not used by the font mapper, but is returned when raster, vector, or TrueType fonts are enumerated.
20 | ///
21 | STROKE=2,
22 |
23 | ///
24 | /// Not used.
25 | ///
26 | MASK=0xf,
27 |
28 | ///
29 | /// When this value is used, the rotation for all fonts depends on whether the orientation of the coordinate system is left-handed or right-handed.
30 | /// If not used, device fonts always rotate counterclockwise, but the rotation of other fonts is dependent on the orientation of the coordinate system.
31 | ///
32 | LH_ANGLES=(1<<4),
33 |
34 | ///
35 | /// Not used.
36 | ///
37 | TT_ALWAYS=(2<<4),
38 |
39 | ///
40 | /// Windows XP SP1: Turns off font association for the font. Note that this flag is not guaranteed to have any effect on any platform after Windows Server 2003.
41 | ///
42 | DFA_DISABLE=(4<<4),
43 |
44 | ///
45 | /// You must specify this flag to use an embedded read-only font.
46 | ///
47 | EMBEDDED=(8<<4),
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/GDI/Defines/PitchAndFamily.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Win32
4 | {
5 | ///
6 | /// The pitch and family of the font. The low-order bits (Bit 1-0) specify the pitch,
7 | /// the higher-order bits (7-4) specify the font family. Bit 3 specifies monospace font.
8 | ///
9 | [Flags]
10 | public enum PitchAndFamily : uint
11 | {
12 | ///
13 | /// Default pitch.
14 | ///
15 | DEFAULT_PITCH=0,
16 |
17 | ///
18 | /// Fixed pitch.
19 | ///
20 | FIXED_PITCH=1,
21 |
22 | ///
23 | /// Variable pitch.
24 | ///
25 | VARIABLE_PITCH=2,
26 |
27 | ///
28 | /// Monospace font.
29 | ///
30 | MONO_FONT=8,
31 |
32 | ///
33 | /// Don't care or don't know.
34 | ///
35 | FF_DONTCARE=0,
36 |
37 | ///
38 | /// Variable stroke width, serifed. (Times Roman, Century Schoolbook, etc.)
39 | ///
40 | FF_ROMAN=0x10,
41 |
42 | ///
43 | /// Variable stroke width, sans-serifed. (Helvetica, Swiss, etc.)
44 | ///
45 | FF_SWISS=0x20,
46 |
47 | ///
48 | /// Constant stroke width, serifed or sans-serifed. (Pica, Elite, Courier, etc.)
49 | ///
50 | FF_MODERN=0x30,
51 |
52 | ///
53 | /// Fonts designed to look like handwriting. (Cursive, etc.)
54 | ///
55 | FF_SCRIPT=0x40,
56 |
57 | ///
58 | /// Novelty fonts. (Old English, etc.)
59 | ///
60 | FF_DECORATIVE=0x50,
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/GDI/Defines/LogFontPitchAndFamily.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Win32
4 | {
5 | ///
6 | /// The pitch and family of the font. The low-order bits (Bit 1-0) specify the pitch, the higher-order bits (7-4) specify the font family. Bit 3 specifies monospace font.
7 | ///
8 | [Flags]
9 | public enum LogFontPitchAndFamily : byte
10 | {
11 | ///
12 | /// Default pitch.
13 | ///
14 | DEFAULT_PITCH=0,
15 |
16 | ///
17 | /// Fixed pitch.
18 | ///
19 | FIXED_PITCH=1,
20 |
21 | ///
22 | /// Variable pitch.
23 | ///
24 | VARIABLE_PITCH=2,
25 |
26 | ///
27 | /// Monospace font.
28 | ///
29 | MONO_FONT=8,
30 |
31 | ///
32 | /// Don't care or don't know.
33 | ///
34 | FF_DONTCARE=0,
35 |
36 | ///
37 | /// Variable stroke width, serifed. (Times Roman, Century Schoolbook, etc.)
38 | ///
39 | FF_ROMAN=0x10,
40 |
41 | ///
42 | /// Variable stroke width, sans-serifed. (Helvetica, Swiss, etc.)
43 | ///
44 | FF_SWISS=0x20,
45 |
46 | ///
47 | /// Constant stroke width, serifed or sans-serifed. (Pica, Elite, Courier, etc.)
48 | ///
49 | FF_MODERN=0x30,
50 |
51 | ///
52 | /// Fonts designed to look like handwriting. (Cursive, etc.)
53 | ///
54 | FF_SCRIPT=0x40,
55 |
56 | ///
57 | /// Novelty fonts. (Old English, etc.)
58 | ///
59 | FF_DECORATIVE=0x50,
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/IO/Filesystem.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.InteropServices;
3 | using System.Security;
4 |
5 | namespace Win32.IO
6 | {
7 | ///
8 | /// Class for file system operations.
9 | ///
10 | [SuppressUnmanagedCodeSecurity]
11 | public static class Filesystem
12 | {
13 | const string DLLName="Kernel32.dll";
14 | const string CreateHardLinkW="CreateHardLinkW";
15 |
16 | ///
17 | /// Creates a hard link between an existing file and a new file.
18 | ///
19 | /// The name of the new file.
20 | /// The name of the existing file.
21 | /// Reserved; must be 0 (zero).
22 | /// true if the function succeeds, otherwise false.
23 | [DllImport(DLLName, EntryPoint=CreateHardLinkW, ExactSpelling=true, CharSet=CharSet.Unicode)]
24 | public static extern bool CreateHardLink(string lpFileName, string lpExistingFileName, IntPtr p);
25 |
26 | ///
27 | /// Creates a hard link between an existing file and a new file.
28 | ///
29 | /// The name of the new file.
30 | /// The name of the existing file.
31 | /// true if the function succeeds, otherwise false.
32 | public static bool CreateHardLink(string newFileName, string existingFileName)
33 | {
34 | return CreateHardLink(newFileName, existingFileName, IntPtr.Zero);
35 | }
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/IO/RawInput/Structs/RAWKEYBOARD.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.InteropServices;
3 |
4 | namespace Win32.IO.RawInput
5 | {
6 | ///
7 | /// Contains information about the state of the keyboard.
8 | ///
9 | [StructLayout(LayoutKind.Sequential)]
10 | [CLSCompliant(false)]
11 | public struct RAWKEYBOARD
12 | {
13 | ///
14 | /// The scan code from the key depression. The scan code for keyboard overrun is
15 | /// KEYBOARD_OVERRUN_MAKE_CODE.
16 | ///
17 | public ushort MakeCode;
18 |
19 | ///
20 | /// Flags for scan code information.
21 | ///
22 | public RI_KEY Flags;
23 |
24 | ///
25 | /// Reserved; must be zero.
26 | ///
27 | public ushort Reserved;
28 |
29 | ///
30 | /// Windows message compatible virtual-key code. For more information, see Virtual Key Codes.
31 | ///
32 | public ushort VKey;
33 |
34 | ///
35 | /// The corresponding window message, for example WM_KEYDOWN,
36 | /// WM_SYSKEYDOWN, and so forth.
37 | ///
38 | public /*WM*/ uint Message;
39 |
40 | ///
41 | /// The device-specific additional information for the event.
42 | ///
43 | public uint ExtraInformation;
44 |
45 | ///
46 | /// Size of in bytes.
47 | ///
48 | public static readonly uint SIZE=(uint)Marshal.SizeOf(typeof(RAWKEYBOARD));
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/IO/HumanInterfaceDevices/Defines/HID_USAGE_GENERIC_DEVICE.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Win32.IO.HumanInterfaceDevices
4 | {
5 | ///
6 | /// Defines the usage of "Human Interface Devices" on Usage Page 6 (Generic Device Controls)
7 | ///
8 | [CLSCompliant(false)]
9 | public static class HID_USAGE_GENERIC_DEVICE
10 | {
11 | ///
12 | /// Unidentified
13 | ///
14 | public const ushort UNIDENTIFIED=0x00;
15 |
16 | //public const ushort reserved=0x01;
17 | //...
18 | //public const ushort reserved=0x1f;
19 |
20 | ///
21 | /// Battery Strength
22 | ///
23 | public const ushort BATTERY_STRENGTH=0x20;
24 |
25 | ///
26 | /// Wireless Channel
27 | ///
28 | public const ushort WIRELESS_CHANNEL=0x21;
29 |
30 | ///
31 | /// Wireless ID
32 | ///
33 | public const ushort WIRELESS_ID=0x22;
34 |
35 | ///
36 | /// Discover Wireless Control
37 | ///
38 | public const ushort DISCOVER_WIRELESS_CONTROL=0x23;
39 |
40 | ///
41 | /// Security Code Character Entered
42 | ///
43 | public const ushort SECURITY_CODE_CHARACTER_ENTERED=0x24;
44 |
45 | ///
46 | /// Security Code Character Erased
47 | ///
48 | public const ushort SECURITY_CODE_CHARACTER_ERASED=0x25;
49 |
50 | ///
51 | /// Security Code Cleared
52 | ///
53 | public const ushort SECURITY_CODE_CLEARED=0x26;
54 |
55 | //public const ushort reserved=0x27;
56 | //...
57 | //public const ushort reserved=0xffff;
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/GDI/Defines/VP_FLAGS.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Win32
4 | {
5 | ///
6 | /// Indicates the members that contain valid data.
7 | ///
8 | [Flags]
9 | public enum VP_FLAGS : uint
10 | {
11 | ///
12 | /// .
13 | ///
14 | TV_MODE=0x0001,
15 |
16 | ///
17 | /// .
18 | ///
19 | TV_STANDARD=0x0002,
20 |
21 | ///
22 | /// .
23 | ///
24 | FLICKER=0x0004,
25 |
26 | ///
27 | /// and .
28 | ///
29 | OVERSCAN=0x0008,
30 |
31 | ///
32 | /// and . Do not use if is .
33 | ///
34 | MAX_UNSCALED=0x0010,
35 |
36 | ///
37 | /// and .
38 | ///
39 | POSITION=0x0020,
40 |
41 | ///
42 | /// .
43 | ///
44 | BRIGHTNESS=0x0040,
45 |
46 | ///
47 | /// .
48 | ///
49 | CONTRAST=0x0080,
50 |
51 | ///
52 | /// , and .
53 | ///
54 | COPYPROTECT=0x0100,
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/GDI/Defines/DMBIN.cs:
--------------------------------------------------------------------------------
1 | namespace Win32
2 | {
3 | ///
4 | /// Specifies the paper source.
5 | ///
6 | public enum DMBIN : short
7 | {
8 | ///
9 | ///
10 | ///
11 | ONLYONE=1,
12 |
13 | ///
14 | /// Upper.
15 | ///
16 | UPPER=1,
17 |
18 | ///
19 | /// Lower.
20 | ///
21 | LOWER=2,
22 |
23 | ///
24 | /// Middle.
25 | ///
26 | MIDDLE=3,
27 |
28 | ///
29 | /// Manual.
30 | ///
31 | MANUAL=4,
32 |
33 | ///
34 | /// Envelope.
35 | ///
36 | ENVELOPE=5,
37 |
38 | ///
39 | /// Envelope manual.
40 | ///
41 | ENVMANUAL=6,
42 |
43 | ///
44 | /// Auto.
45 | ///
46 | AUTO=7,
47 |
48 | ///
49 | /// Tractor.
50 | ///
51 | TRACTOR=8,
52 |
53 | ///
54 | /// Smale format.
55 | ///
56 | SMALLFMT=9,
57 |
58 | ///
59 | /// Large format.
60 | ///
61 | LARGEFMT=10,
62 |
63 | ///
64 | /// Large capacity.
65 | ///
66 | LARGECAPACITY=11,
67 |
68 | ///
69 | /// Casette.
70 | ///
71 | CASSETTE=14,
72 |
73 | ///
74 | /// Form source.
75 | ///
76 | FORMSOURCE=15,
77 |
78 | ///
79 | /// First predefined paper source.
80 | ///
81 | FIRST=UPPER,
82 |
83 | ///
84 | /// Last predefined paper source.
85 | ///
86 | LAST=FORMSOURCE,
87 |
88 | ///
89 | /// Start of the user-defined paper sources.
90 | ///
91 | USER=256,
92 | }
93 | }
94 |
--------------------------------------------------------------------------------
/IO/Defines/SECURITY.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Win32.IO
4 | {
5 | ///
6 | /// Defines security quality of service flags.
7 | ///
8 | [CLSCompliant(false)]
9 | [Flags]
10 | public enum SECURITY : uint
11 | {
12 | ///
13 | /// Impersonates a client at the Anonymous impersonation level.
14 | ///
15 | ANONYMOUS=SECURITY_IMPERSONATION_LEVEL.SecurityAnonymous<<16,
16 |
17 | ///
18 | /// Impersonates a client at the Identification impersonation level.
19 | ///
20 | IDENTIFICATION=SECURITY_IMPERSONATION_LEVEL.SecurityIdentification<<16,
21 |
22 | ///
23 | /// Impersonate a client at the impersonation level. This is the default behavior
24 | /// if no other flags are specified along with the SECURITY_SQOS_PRESENT flag.
25 | ///
26 | IMPERSONATION=SECURITY_IMPERSONATION_LEVEL.SecurityImpersonation<<16,
27 |
28 | ///
29 | /// Impersonates a client at the Delegation impersonation level.
30 | ///
31 | DELEGATION=SECURITY_IMPERSONATION_LEVEL.SecurityDelegation<<16,
32 |
33 | ///
34 | /// The security tracking mode is dynamic. If this flag is not specified, the
35 | /// security tracking mode is static.
36 | ///
37 | CONTEXT_TRACKING=0x00040000,
38 |
39 | ///
40 | /// Only the enabled aspects of the client's security context are available
41 | /// to the server. If you do not specify this flag, all aspects of the client's
42 | /// security context are available.
43 | /// This allows the client to limit the groups and privileges that a server
44 | /// can use while impersonating the client.
45 | ///
46 | EFFECTIVE_ONLY=0x00080000,
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/GDI/Defines/FW.cs:
--------------------------------------------------------------------------------
1 | namespace Win32
2 | {
3 | ///
4 | /// Font Weights
5 | ///
6 | public static class FW
7 | {
8 | ///
9 | /// 0
10 | ///
11 | public const uint DONTCARE=0;
12 |
13 | ///
14 | /// 100
15 | ///
16 | public const uint THIN=100;
17 |
18 | ///
19 | /// 200
20 | ///
21 | public const uint EXTRALIGHT=200;
22 |
23 | ///
24 | /// 300
25 | ///
26 | public const uint LIGHT=300;
27 |
28 | ///
29 | /// 400
30 | ///
31 | public const uint NORMAL=400;
32 |
33 | ///
34 | /// 500
35 | ///
36 | public const uint MEDIUM=500;
37 |
38 | ///
39 | /// 600
40 | ///
41 | public const uint SEMIBOLD=600;
42 |
43 | ///
44 | /// 700
45 | ///
46 | public const uint BOLD=700;
47 |
48 | ///
49 | /// 800
50 | ///
51 | public const uint EXTRABOLD=800;
52 |
53 | ///
54 | /// 900
55 | ///
56 | public const uint HEAVY=900;
57 |
58 | ///
59 | /// Same as .
60 | ///
61 | public const uint ULTRALIGHT=EXTRALIGHT;
62 |
63 | ///
64 | /// Same as .
65 | ///
66 | public const uint REGULAR=NORMAL;
67 |
68 | ///
69 | /// Same as .
70 | ///
71 | public const uint DEMIBOLD=SEMIBOLD;
72 |
73 | ///
74 | /// Same as .
75 | ///
76 | public const uint ULTRABOLD=EXTRABOLD;
77 |
78 | ///
79 | /// Same as .
80 | ///
81 | public const uint BLACK=HEAVY;
82 | }
83 | }
84 |
--------------------------------------------------------------------------------
/GDI/Defines/GGO.cs:
--------------------------------------------------------------------------------
1 | namespace Win32
2 | {
3 | ///
4 | /// GetGlyphOutline constants.
5 | ///
6 | public enum GGO : uint
7 | {
8 | ///
9 | /// Only retrieves the structure.
10 | ///
11 | METRICS=0,
12 |
13 | ///
14 | /// The function retrieves the glyph bitmap. For information about memory allocation, see the following Remarks section.
15 | ///
16 | BITMAP=1,
17 |
18 | ///
19 | /// The function retrieves the curve data points in the rasterizer's native format and uses the font's design units.
20 | ///
21 | NATIVE=2,
22 |
23 | ///
24 | /// The function retrieves the curve data as a cubic Bézier spline (not in quadratic spline format).
25 | ///
26 | BEZIER=3,
27 |
28 | ///
29 | /// The function retrieves a glyph bitmap that contains five levels of gray.
30 | ///
31 | GRAY2_BITMAP=4,
32 |
33 | ///
34 | /// The function retrieves a glyph bitmap that contains 17 levels of gray.
35 | ///
36 | GRAY4_BITMAP=5,
37 |
38 | ///
39 | /// The function retrieves a glyph bitmap that contains 65 levels of gray.
40 | ///
41 | GRAY8_BITMAP=6,
42 |
43 | ///
44 | /// Indicates that the uChar parameter of GetGlyphOutline is a TrueType Glyph Index rather than a character code.
45 | ///
46 | GLYPH_INDEX=0x0080,
47 |
48 | ///
49 | /// The function only returns unhinted outlines. This flag only works in conjunction with and .
50 | ///
51 | UNHINTED=0x0100,
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/GDI/Structs/MAT2.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.InteropServices;
2 |
3 | namespace Win32
4 | {
5 | ///
6 | /// Fixed-point real number used be .
7 | ///
8 | [StructLayout(LayoutKind.Sequential, Pack=1)]
9 | public struct Fixed
10 | {
11 | ///
12 | /// Fraction.
13 | ///
14 | public ushort fract;
15 |
16 | ///
17 | /// Value.
18 | ///
19 | public short value;
20 |
21 | ///
22 | /// Initializes an instance of Fixed.
23 | ///
24 | /// The integral value.
25 | /// The fractional value.
26 | public Fixed(short value, ushort fract=0)
27 | {
28 | this.value=value;
29 | this.fract=fract;
30 | }
31 | }
32 |
33 | ///
34 | /// Defines the values for a transformation matrix used by the GetGlyphOutline function.
35 | ///
36 | [StructLayout(LayoutKind.Sequential)]
37 | public struct Mat2
38 | {
39 | ///
40 | /// The M11 component of a 2 by 2 transformation matrix.
41 | ///
42 | public Fixed eM11;
43 |
44 | ///
45 | /// The M12 component of a 2 by 2 transformation matrix.
46 | ///
47 | public Fixed eM12;
48 |
49 | ///
50 | /// The M21 component of a 2 by 2 transformation matrix.
51 | ///
52 | public Fixed eM21;
53 |
54 | ///
55 | /// The M22 component of a 2 by 2 transformation matrix.
56 | ///
57 | public Fixed eM22;
58 |
59 | ///
60 | /// Returns the identity matrix.
61 | ///
62 | public static Mat2 Identity { get { Mat2 ret; ret.eM11=ret.eM22=new Fixed(1); ret.eM12=ret.eM21=new Fixed(); return ret; } }
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/IO/HumanInterfaceDevices/Defines/HID_USAGE_VR.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Win32.IO.HumanInterfaceDevices
4 | {
5 | ///
6 | /// Defines the usage of "Human Interface Devices" on Usage Page 3 (VR Controls)
7 | ///
8 | [CLSCompliant(false)]
9 | public static class HID_USAGE_VR
10 | {
11 | ///
12 | /// Unidentified
13 | ///
14 | public const ushort UNIDENTIFIED=0x00;
15 |
16 | ///
17 | /// Belt
18 | ///
19 | public const ushort BELT=0x01;
20 |
21 | ///
22 | /// Body Suit
23 | ///
24 | public const ushort BODY_SUIT=0x02;
25 |
26 | ///
27 | /// Flexor
28 | ///
29 | public const ushort FLEXOR=0x03;
30 |
31 | ///
32 | /// Glove
33 | ///
34 | public const ushort GLOVE=0x04;
35 |
36 | ///
37 | /// Head Tracker
38 | ///
39 | public const ushort HEAD_TRACKER=0x05;
40 |
41 | ///
42 | /// Head Mounted Display
43 | ///
44 | public const ushort HEAD_MOUNTED_DISPLAY=0x06;
45 |
46 | ///
47 | /// Hand Tracker
48 | ///
49 | public const ushort HAND_TRACKER=0x07;
50 |
51 | ///
52 | /// Oculometer
53 | ///
54 | public const ushort OCULOMETER=0x08;
55 |
56 | ///
57 | /// Vest
58 | ///
59 | public const ushort VEST=0x09;
60 |
61 | ///
62 | /// Animatronic Device
63 | ///
64 | public const ushort ANIMATRONIC_DEVICE=0x0a;
65 |
66 | //public const ushort reserved=0x0b;
67 | //...
68 | //public const ushort reserved=0x1f;
69 |
70 | ///
71 | /// Stereo Enable
72 | ///
73 | public const ushort STEREO_ENABLE=0x20;
74 |
75 | ///
76 | /// Display Enable
77 | ///
78 | public const ushort DISPLAY_ENABLE=0x21;
79 |
80 | //public const ushort reserved=0x22;
81 | //...
82 | //public const ushort reserved=0xffff;
83 | }
84 | }
85 |
--------------------------------------------------------------------------------
/IO/RawInput/Structs/RAWMOUSE.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.InteropServices;
3 |
4 | namespace Win32.IO.RawInput
5 | {
6 | ///
7 | /// Contains information about the state of the mouse.
8 | ///
9 | [StructLayout(LayoutKind.Explicit)]
10 | [CLSCompliant(false)]
11 | public struct RAWMOUSE
12 | {
13 | ///
14 | /// The mouse state.
15 | ///
16 | [FieldOffset(0)]
17 | public MOUSE usFlags;
18 |
19 | ///
20 | /// Reserved.
21 | ///
22 | [FieldOffset(4)]
23 | public uint ulButtons;
24 |
25 | ///
26 | /// The transition state of the mouse buttons.
27 | ///
28 | [FieldOffset(4)]
29 | public RI_MOUSE usButtonFlags;
30 |
31 | ///
32 | /// If is RI_MOUSE_WHEEL,
33 | /// this member is a signed value that specifies the wheel delta.
34 | ///
35 | [FieldOffset(6)]
36 | public ushort usButtonData;
37 |
38 | ///
39 | /// The raw state of the mouse buttons.
40 | ///
41 | [FieldOffset(8)]
42 | public uint ulRawButtons;
43 |
44 | ///
45 | /// The motion in the X direction. This is signed relative motion or absolute motion,
46 | /// depending on the value of .
47 | ///
48 | [FieldOffset(12)]
49 | public int lLastX;
50 |
51 | ///
52 | /// The motion in the Y direction. This is signed relative motion or absolute motion,
53 | /// depending on the value of .
54 | ///
55 | [FieldOffset(16)]
56 | public int lLastY;
57 |
58 | ///
59 | /// The device-specific additional information for the event.
60 | ///
61 | [FieldOffset(20)]
62 | public uint ulExtraInformation;
63 |
64 | ///
65 | /// Size of in bytes.
66 | ///
67 | public static readonly uint SIZE=(uint)Marshal.SizeOf(typeof(RAWMOUSE));
68 | }
69 | }
70 |
--------------------------------------------------------------------------------
/GDI/Defines/CharSet.cs:
--------------------------------------------------------------------------------
1 | namespace Win32
2 | {
3 | ///
4 | /// Character sets.
5 | ///
6 | public enum Charset : uint
7 | {
8 | ///
9 | /// ANSI
10 | ///
11 | ANSI=0,
12 |
13 | ///
14 | /// Value based on the current system locale.
15 | ///
16 | DEFAULT=1,
17 |
18 | ///
19 | /// Symbol
20 | ///
21 | SYMBOL=2,
22 |
23 | ///
24 | /// Mac
25 | ///
26 | MAC=77,
27 |
28 | ///
29 | /// Japanise
30 | ///
31 | SHIFTJIS=128,
32 |
33 | ///
34 | /// HANGUL
35 | ///
36 | HANGUL=129,
37 |
38 | ///
39 | /// HANGUEL
40 | ///
41 | HANGEUL=HANGUL,
42 |
43 | ///
44 | /// Korean
45 | ///
46 | JOHAB=130,
47 |
48 | ///
49 | /// Simple chinese
50 | ///
51 | GB2312=134,
52 |
53 | ///
54 | /// Traditional chinese
55 | ///
56 | CHINESEBIG5=136,
57 |
58 | ///
59 | /// Greek
60 | ///
61 | GREEK=161,
62 |
63 | ///
64 | /// Turkish
65 | ///
66 | TURKISH=162,
67 |
68 | ///
69 | /// Vietnamese
70 | ///
71 | VIETNAMESE=163,
72 |
73 | ///
74 | /// Hebrew
75 | ///
76 | HEBREW=177,
77 |
78 | ///
79 | /// Arabic
80 | ///
81 | ARABIC=178,
82 |
83 | ///
84 | /// Baltic languages.
85 | ///
86 | BALTIC=186,
87 |
88 | ///
89 | /// Russian
90 | ///
91 | RUSSIAN=204,
92 |
93 | ///
94 | /// Thai
95 | ///
96 | THAI=222,
97 |
98 | ///
99 | /// Eastern europe languages.
100 | ///
101 | EASTEUROPE=238,
102 |
103 | ///
104 | /// Is operating-system dependent.
105 | ///
106 | OEM=255,
107 | }
108 | }
109 |
--------------------------------------------------------------------------------
/GDI/Defines/LogFontCharSet.cs:
--------------------------------------------------------------------------------
1 | namespace Win32
2 | {
3 | ///
4 | /// Character sets.
5 | ///
6 | public enum LogFontCharSet : byte
7 | {
8 | ///
9 | /// ANSI
10 | ///
11 | ANSI=0,
12 |
13 | ///
14 | /// Value based on the current system locale.
15 | ///
16 | DEFAULT=1,
17 |
18 | ///
19 | /// Symbol
20 | ///
21 | SYMBOL=2,
22 |
23 | ///
24 | /// Mac
25 | ///
26 | MAC=77,
27 |
28 | ///
29 | /// Japanise
30 | ///
31 | SHIFTJIS=128,
32 |
33 | ///
34 | /// HANGUL
35 | ///
36 | HANGUL=129,
37 |
38 | ///
39 | /// HANGUEL
40 | ///
41 | HANGEUL=HANGUL,
42 |
43 | ///
44 | /// Korean
45 | ///
46 | JOHAB=130,
47 |
48 | ///
49 | /// Simple chinese
50 | ///
51 | GB2312=134,
52 |
53 | ///
54 | /// Traditional chinese
55 | ///
56 | CHINESEBIG5=136,
57 |
58 | ///
59 | /// Greek
60 | ///
61 | GREEK=161,
62 |
63 | ///
64 | /// Turkish
65 | ///
66 | TURKISH=162,
67 |
68 | ///
69 | /// Vietnamese
70 | ///
71 | VIETNAMESE=163,
72 |
73 | ///
74 | /// Hebrew
75 | ///
76 | HEBREW=177,
77 |
78 | ///
79 | /// Arabic
80 | ///
81 | ARABIC=178,
82 |
83 | ///
84 | /// Baltic languages.
85 | ///
86 | BALTIC=186,
87 |
88 | ///
89 | /// Russian
90 | ///
91 | RUSSIAN=204,
92 |
93 | ///
94 | /// Thai
95 | ///
96 | THAI=222,
97 |
98 | ///
99 | /// Eastern europe languages.
100 | ///
101 | EASTEUROPE=238,
102 |
103 | ///
104 | /// Is operating-system dependent.
105 | ///
106 | OEM=255,
107 | }
108 | }
109 |
--------------------------------------------------------------------------------
/GDI/Defines/OUT_PRECIS.cs:
--------------------------------------------------------------------------------
1 | namespace Win32
2 | {
3 | ///
4 | /// The output precision.
5 | ///
6 | public enum OUT_PRECIS : uint
7 | {
8 | ///
9 | /// The default font mapper behavior.
10 | ///
11 | DEFAULT=0,
12 |
13 | ///
14 | /// This value is not used by the font mapper, but it is returned when raster fonts are enumerated.
15 | ///
16 | STRING=1,
17 |
18 | ///
19 | /// Not used.
20 | ///
21 | CHARACTER=2,
22 |
23 | ///
24 | /// This value is not used by the font mapper, but it is returned when TrueType, other outline-based fonts, and vector fonts are enumerated.
25 | ///
26 | STROKE=3,
27 |
28 | ///
29 | /// Instructs the font mapper to choose a TrueType font when the system contains multiple fonts with the same name.
30 | ///
31 | TT=4,
32 |
33 | ///
34 | /// Instructs the font mapper to choose a Device font when the system contains multiple fonts with the same name.
35 | ///
36 | DEVICE=5,
37 |
38 | ///
39 | /// Instructs the font mapper to choose a raster font when the system contains multiple fonts with the same name.
40 | ///
41 | RASTER=6,
42 |
43 | ///
44 | /// Instructs the font mapper to choose from only TrueType fonts. If there are no TrueType fonts installed in the system, the font mapper returns to default behavior.
45 | ///
46 | TT_ONLY=7,
47 |
48 | ///
49 | /// This value instructs the font mapper to choose from TrueType and other outline-based fonts.
50 | ///
51 | OUTLINE=8,
52 |
53 | ///
54 | /// This value instructs the font mapper to choose from TrueType and other outline-based fonts.
55 | ///
56 | SCREEN_OUTLINE=9,
57 |
58 | ///
59 | /// Instructs the font mapper to choose from only PostScript fonts. If there are no PostScript fonts installed in the system, the font mapper returns to default behavior.
60 | ///
61 | PS_ONLY=10,
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/GDI/Defines/LogFontPrecision.cs:
--------------------------------------------------------------------------------
1 | namespace Win32
2 | {
3 | ///
4 | /// The output precision.
5 | ///
6 | public enum LogFontPrecision : byte
7 | {
8 | ///
9 | /// The default font mapper behavior.
10 | ///
11 | DEFAULT=0,
12 |
13 | ///
14 | /// This value is not used by the font mapper, but it is returned when raster fonts are enumerated.
15 | ///
16 | STRING=1,
17 |
18 | ///
19 | /// Not used.
20 | ///
21 | CHARACTER=2,
22 |
23 | ///
24 | /// This value is not used by the font mapper, but it is returned when TrueType, other outline-based fonts, and vector fonts are enumerated.
25 | ///
26 | STROKE=3,
27 |
28 | ///
29 | /// Instructs the font mapper to choose a TrueType font when the system contains multiple fonts with the same name.
30 | ///
31 | TT=4,
32 |
33 | ///
34 | /// Instructs the font mapper to choose a Device font when the system contains multiple fonts with the same name.
35 | ///
36 | DEVICE=5,
37 |
38 | ///
39 | /// Instructs the font mapper to choose a raster font when the system contains multiple fonts with the same name.
40 | ///
41 | RASTER=6,
42 |
43 | ///
44 | /// Instructs the font mapper to choose from only TrueType fonts. If there are no TrueType fonts installed in the system, the font mapper returns to default behavior.
45 | ///
46 | TT_ONLY=7,
47 |
48 | ///
49 | /// This value instructs the font mapper to choose from TrueType and other outline-based fonts.
50 | ///
51 | OUTLINE=8,
52 |
53 | ///
54 | /// This value instructs the font mapper to choose from TrueType and other outline-based fonts.
55 | ///
56 | SCREEN_OUTLINE=9,
57 |
58 | ///
59 | /// Instructs the font mapper to choose from only PostScript fonts. If there are no PostScript fonts installed in the system, the font mapper returns to default behavior.
60 | ///
61 | PS_ONLY=10,
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/Window/Defines/DCX.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Win32
4 | {
5 | ///
6 | /// Specifies how the DC is created.
7 | ///
8 | [Flags]
9 | public enum DCX : uint
10 | {
11 | ///
12 | /// Returns a DC that corresponds to the window rectangle rather than the client rectangle.
13 | ///
14 | WINDOW=0x00000001,
15 |
16 | ///
17 | /// Returns a DC from the cache, rather than the OWNDC or CLASSDC window. Essentially overrides CS_OWNDC and CS_CLASSDC.
18 | ///
19 | CACHE=0x00000002,
20 |
21 | ///
22 | /// Uses the visible region of the parent window. The parent's WS_CLIPCHILDREN and CS_PARENTDC style bits are ignored. The origin is set to the upper-left corner of the window.
23 | ///
24 | PARENTCLIP=0x00000020,
25 |
26 | ///
27 | /// Excludes the visible regions of all sibling windows above the window.
28 | ///
29 | CLIPSIBLINGS=0x00000010,
30 |
31 | ///
32 | /// Excludes the visible regions of all child windows below the window.
33 | ///
34 | CLIPCHILDREN=0x00000008,
35 |
36 | ///
37 | /// Does not reset the attributes of this DC to the default attributes when this DC is released.
38 | ///
39 | NORESETATTRS=0x00000004,
40 |
41 | ///
42 | /// Allows drawing even if there is a LockWindowUpdate call in effect that would otherwise exclude this window. Used for drawing during tracking.
43 | ///
44 | LOCKWINDOWUPDATE=0x00000400,
45 |
46 | ///
47 | /// The clipping region is excluded from the visible region of the returned DC.
48 | ///
49 | EXCLUDERGN=0x00000040,
50 |
51 | ///
52 | /// The clipping region is intersected with the visible region of the returned DC.
53 | ///
54 | INTERSECTRGN=0x00000080,
55 |
56 | ///
57 | /// Reserved; do not use.
58 | ///
59 | INTERSECTUPDATE=0x00000200,
60 |
61 | ///
62 | /// Reserved; do not use.
63 | ///
64 | VALIDATE=0x00200000,
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/Monitor/Structs/MonitorInfoEx.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.InteropServices;
3 |
4 | namespace Win32
5 | {
6 | ///
7 | /// Structure containing information about a display monitor. Same as , but additionally containing a device name.
8 | ///
9 | [StructLayout(LayoutKind.Explicit, CharSet=CharSet.Unicode)]
10 | public struct MonitorInfoEx
11 | {
12 | ///
13 | /// Size of in chars.
14 | ///
15 | public const int CCHDEVICENAME=32;
16 |
17 | ///
18 | /// The size, in bytes, of the structure.
19 | ///
20 | [FieldOffset(0)]
21 | public uint cbSize;
22 |
23 | ///
24 | /// A structure that specifies the display monitor rectangle, expressed in virtual-screen coordinates.
25 | ///
26 | [FieldOffset(4)]
27 | public Rect rcMonitor;
28 |
29 | ///
30 | /// A structure that specifies the work area rectangle of the display monitor that can be used by applications, expressed in virtual-screen coordinates.
31 | ///
32 | [FieldOffset(20)]
33 | public Rect rcWork;
34 |
35 | ///
36 | /// A set of flags that represent attributes of the display monitor.
37 | ///
38 | [FieldOffset(36)]
39 | public MonitorInfoFlag dwFlags;
40 |
41 | ///
42 | /// A zero-terminated character array that specifies the "friendly" name of the display.
43 | ///
44 | [FieldOffset(40)]
45 | public unsafe fixed char szDevice[CCHDEVICENAME];
46 |
47 | ///
48 | /// Property to access as string.
49 | ///
50 | public string Device
51 | {
52 | get
53 | {
54 | unsafe
55 | {
56 | fixed(char* devName=szDevice) return new string(devName);
57 | }
58 | }
59 | set
60 | {
61 | int len=Math.Min(value.Length, 31);
62 | unsafe
63 | {
64 | fixed(char* devName=szDevice)
65 | {
66 | for(int i=0; i
8 | /// Defines information for the raw input devices.
9 | ///
10 | ///
11 | ///
12 | /// If RIDEV_NOLEGACY is set for a mouse or a keyboard, the system does not
13 | /// generate any legacy message for that device for the application. For example, if the mouse TLC is set with
14 | /// RIDEV_NOLEGACY, WM_LBUTTONDOWN and
15 | /// related legacy mouse messages are not generated. Likewise, if the keyboard TLC is set with
16 | /// RIDEV_NOLEGACY, WM_KEYDOWN and related
17 | /// legacy keyboard messages are not generated.
18 | ///
19 | ///
20 | /// If RIDEV_REMOVE is set and the member is not set
21 | /// to null (IntPtr.Zero), then parameter validation will fail.
22 | ///
23 | ///
24 | [StructLayout(LayoutKind.Sequential)]
25 | [CLSCompliant(false)]
26 | public struct RAWINPUTDEVICE
27 | {
28 | ///
29 | /// Top level collection Usage page for the raw input device.
30 | ///
31 | public ushort usUsagePage;
32 |
33 | ///
34 | /// Top level collection Usage for the raw input device.
35 | ///
36 | public ushort usUsage;
37 |
38 | ///
39 | /// Mode flag that specifies how to interpret the information provided by
40 | /// usagePage and usage.
41 | /// It can be zero (the default). By default, the operating system sends raw input from devices with the
42 | /// specified top level collection (TLC) to the registered application as long as it has the window focus.
43 | ///
44 | public RIDEV dwFlags;
45 |
46 | ///
47 | /// A handle to the target window. If null (IntPtr.Zero) it follows the keyboard focus.
48 | ///
49 | public HWND hwndTarget;
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/Window/Defines/SWP.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Win32
4 | {
5 | ///
6 | /// Flags for .
7 | ///
8 | [Flags]
9 | public enum SWP : uint
10 | {
11 | ///
12 | /// Retains the current size.
13 | ///
14 | NOSIZE=0x0001,
15 |
16 | ///
17 | /// Retains the current position.
18 | ///
19 | NOMOVE=0x0002,
20 |
21 | ///
22 | /// Retains the current Z order.
23 | ///
24 | NOZORDER=0x0004,
25 |
26 | ///
27 | /// Does not redraw changes.
28 | ///
29 | NOREDRAW=0x0008,
30 |
31 | ///
32 | /// Does not activate the window.
33 | ///
34 | NOACTIVATE=0x0010,
35 |
36 | ///
37 | /// Applies new frame styles. WM_NCCALCSIZE message is send, even if the window's size is not being changed.
38 | ///
39 | FRAMECHANGED=0x0020,
40 |
41 | ///
42 | /// Draws a frame (defined in the window's class description) around the window.
43 | /// Same as .
44 | ///
45 | DRAWFRAME=FRAMECHANGED,
46 |
47 | ///
48 | /// Displays the window.
49 | ///
50 | SHOWWINDOW=0x0040,
51 |
52 | ///
53 | /// Hides the window.
54 | ///
55 | HIDEWINDOW=0x0080,
56 |
57 | ///
58 | /// Discards the entire contents of the client area.
59 | ///
60 | NOCOPYBITS=0x0100,
61 |
62 | ///
63 | /// Does not change the owner window's position in the Z order.
64 | ///
65 | NOOWNERZORDER=0x0200,
66 |
67 | ///
68 | /// Same as .
69 | ///
70 | NOREPOSITION=NOOWNERZORDER,
71 |
72 | ///
73 | /// Prevents the window from receiving the WM_WINDOWPOSCHANGING message.
74 | ///
75 | NOSENDCHANGING=0x0400,
76 |
77 | ///
78 | /// Prevents generation of the WM_SYNCPAINT message.
79 | ///
80 | DEFERERASE=0x2000,
81 |
82 | ///
83 | /// If the calling thread and the thread that owns the window are attached to different input queues,
84 | /// the system posts the request to the thread that owns the window. This prevents the calling thread
85 | /// from blocking its execution while other threads process the request.
86 | ///
87 | ASYNCWINDOWPOS=0x4000,
88 | }
89 | }
90 |
--------------------------------------------------------------------------------
/IO/Defines/FileAccess.cs:
--------------------------------------------------------------------------------
1 | namespace Win32.IO
2 | {
3 | ///
4 | /// Defines the specific access rights to files and directories. See for more information.
5 | ///
6 | public enum FileAccess : uint
7 | {
8 | ///
9 | /// For a file object, the right to read the corresponding file data.
10 | /// For a directory object, the right to read the corresponding directory data.
11 | ///
12 | FILE_READ_DATA=0x0001,
13 |
14 | ///
15 | /// For a directory, the right to list the contents of the directory.
16 | ///
17 | FILE_LIST_DIRECTORY=0x0001,
18 |
19 | ///
20 | /// For a file object, the right to write data to the file.
21 | ///
22 | FILE_WRITE_DATA=0x0002,
23 |
24 | ///
25 | /// For a directory, the right to create a file in the directory.
26 | ///
27 | FILE_ADD_FILE=0x0002,
28 |
29 | ///
30 | /// For a file object, the right to append data to the file.
31 | ///
32 | FILE_APPEND_DATA=0x0004,
33 |
34 | ///
35 | /// For a directory, the right to create a subdirectory.
36 | ///
37 | FILE_ADD_SUBDIRECTORY=0x0004,
38 |
39 | ///
40 | /// For a named pipe, the right to create a pipe.
41 | ///
42 | FILE_CREATE_PIPE_INSTANCE=0x0004,
43 |
44 | ///
45 | /// The right to read extended file attributes.
46 | ///
47 | FILE_READ_EA=0x0008,
48 |
49 | ///
50 | /// The right to write extended file attributes.
51 | ///
52 | FILE_WRITE_EA=0x0010,
53 |
54 | ///
55 | /// For a native code file, the right to execute the file. This access
56 | /// right given to scripts may cause the script to be executable,
57 | /// depending on the script interpreter.
58 | ///
59 | FILE_EXECUTE=0x0020,
60 |
61 | ///
62 | /// For a directory, the right to traverse the directory.
63 | ///
64 | FILE_TRAVERSE=0x0020,
65 |
66 | ///
67 | /// For a directory, the right to delete a directory and all
68 | /// the files it contains, including read-only files.
69 | ///
70 | FILE_DELETE_CHILD=0x0040,
71 |
72 | ///
73 | /// The right to read file attributes.
74 | ///
75 | FILE_READ_ATTRIBUTES=0x0080,
76 |
77 | ///
78 | /// The right to write file attributes.
79 | ///
80 | FILE_WRITE_ATTRIBUTES=0x0100,
81 |
82 | ///
83 | /// All possible access rights for a file.
84 | ///
85 | FILE_ALL_ACCESS=STANDARD_RIGHTS.REQUIRED|ACCESS_MASK.SYNCHRONIZE|0x1FF,
86 | }
87 | }
88 |
--------------------------------------------------------------------------------
/WinKernel/WinKernel.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.InteropServices;
2 | using System.Security;
3 |
4 | namespace Win32
5 | {
6 | ///
7 | /// Class for miscellaneous kernel32.dll functions.
8 | ///
9 | [SuppressUnmanagedCodeSecurity]
10 | public static class WinKernel
11 | {
12 | const string DLLName="Kernel32.dll";
13 |
14 | ///
15 | /// Retrieves the calling thread's last-error code value. The last-error code is maintained on a per-thread basis. Multiple threads do not overwrite each other's last-error code.
16 | ///
17 | /// This is for convenience only, you should use in conjunction with set true.
18 | /// The last-error code.
19 | [DllImport(DLLName)]
20 | public static extern uint GetLastError();
21 |
22 | ///
23 | /// Sets the last-error code for the calling thread.
24 | ///
25 | [DllImport(DLLName)]
26 | public static extern void SetLastError(int error);
27 |
28 | ///
29 | /// Sets the last-error code for the calling thread.
30 | ///
31 | [DllImport(DLLName)]
32 | public static extern void SetLastError(uint error);
33 |
34 | ///
35 | /// Retrieves the current value of the performance counter, which is a high resolution (<1µs) time stamp that can be used for time-interval measurements.
36 | ///
37 | /// Use to query the frequency of the counter.
38 | /// The variable that receives the current performance-counter value, in counts.
39 | /// true if successful; otherwise, false. Use to get extended error information.
40 | [DllImport(DLLName)]
41 | public static extern bool QueryPerformanceCounter(out long lpPerformanceCount);
42 |
43 | ///
44 | /// Retrieves the frequency of the performance counter. The frequency of the performance counter is fixed at system boot and is consistent across all processors. Therefore, the frequency need only be queried upon application initialization, and the result can be cached.
45 | ///
46 | /// The variable that receives the current performance-counter frequency, in counts per second.
47 | /// true the installed hardware supports a high-resolution performance counter; otherwise, false. Use to get extended error information.
48 | [DllImport(DLLName)]
49 | public static extern bool QueryPerformanceFrequency(out long lpFrequency);
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/GDI/Defines/CDS.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Win32
4 | {
5 | ///
6 | /// Specifies flags for DisplayMode.ChangeDisplaySettings and
7 | /// DisplayMode.ChangeDisplaySettingsEx.
8 | ///
9 | [Flags]
10 | public enum CDS : uint
11 | {
12 | ///
13 | /// The graphics mode for the current screen will be changed dynamically.
14 | ///
15 | NONE=0,
16 |
17 | ///
18 | /// The graphics mode for the current screen will be changed dynamically and the graphics mode will be updated in the registry. The mode information is stored in the USER profile.
19 | ///
20 | UPDATEREGISTRY=0x00000001,
21 |
22 | ///
23 | /// The system tests if the requested graphics mode could be set.
24 | ///
25 | TEST=0x00000002,
26 |
27 | ///
28 | /// The mode is temporary in nature.
29 | /// If you change to and from another desktop, this mode will not be reset.
30 | ///
31 | FULLSCREEN=0x00000004,
32 |
33 | ///
34 | /// The settings will be saved in the global settings area so that they will affect all users on the machine. Otherwise, only the settings for the user are modified. This flag is only valid when specified with the flag.
35 | ///
36 | GLOBAL=0x00000008,
37 |
38 | ///
39 | /// This device will become the primary device.
40 | ///
41 | SET_PRIMARY=0x00000010,
42 |
43 | ///
44 | /// When set, the lParam parameter of DisplayMode.ChangeDisplaySettingsEx is a pointer to a structure.
45 | ///
46 | VIDEOPARAMETERS=0x00000020,
47 |
48 | ///
49 | /// Enables settings changes to unsafe graphics modes.
50 | ///
51 | ENABLE_UNSAFE_MODES=0x00000100,
52 |
53 | ///
54 | /// Disables settings changes to unsafe graphics modes.
55 | ///
56 | DISABLE_UNSAFE_MODES=0x00000200,
57 |
58 | ///
59 | /// The settings should be changed, even if the requested settings are the same as the current settings.
60 | ///
61 | RESET=0x40000000,
62 |
63 | ///
64 | /// The settings should be changed, even if the requested settings are the same as the current settings.
65 | ///
66 | RESET_EX=0x20000000,
67 |
68 | ///
69 | /// The settings will be saved in the registry, but will not take effect. This flag is only valid when specified with the flag.
70 | ///
71 | NORESET=0x10000000,
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/GDI/Defines/VP_TV_STANDARD.cs:
--------------------------------------------------------------------------------
1 | namespace Win32
2 | {
3 | ///
4 | /// Specifies the television standard.
5 | ///
6 | public enum VP_TV_STANDARD : uint
7 | {
8 | ///
9 | /// NTSC television standard, type M.
10 | ///
11 | NTSC_M=0x00000001,
12 |
13 | ///
14 | /// NTSC television standard, type M, for Japan.
15 | ///
16 | NTSC_M_J=0x00000002,
17 |
18 | ///
19 | /// PAL television standard, type B.
20 | ///
21 | PAL_B=0x00000004,
22 |
23 | ///
24 | /// PAL television standard, type D.
25 | ///
26 | PAL_D=0x00000008,
27 |
28 | ///
29 | /// PAL television standard, type H.
30 | ///
31 | PAL_H=0x00000010,
32 |
33 | ///
34 | /// PAL television standard, type I.
35 | ///
36 | PAL_I=0x00000020,
37 |
38 | ///
39 | /// PAL television standard, type M.
40 | ///
41 | PAL_M=0x00000040,
42 |
43 | ///
44 | /// PAL television standard, type N.
45 | ///
46 | PAL_N=0x00000080,
47 |
48 | ///
49 | /// Systeme Electronique Couleur avec Memoire (SECAM) television standard, type B.
50 | ///
51 | SECAM_B=0x00000100,
52 |
53 | ///
54 | /// SECAM television standard, type D.
55 | ///
56 | SECAM_D=0x00000200,
57 |
58 | ///
59 | /// SECAM television standard, type G.
60 | ///
61 | SECAM_G=0x00000400,
62 |
63 | ///
64 | /// SECAM television standard, type H.
65 | ///
66 | SECAM_H=0x00000800,
67 |
68 | ///
69 | /// SECAM television standard, type K.
70 | ///
71 | SECAM_K=0x00001000,
72 |
73 | ///
74 | /// SECAM television standard, type K1.
75 | ///
76 | SECAM_K1=0x00002000,
77 |
78 | ///
79 | /// SECAM television standard, type L.
80 | ///
81 | SECAM_L=0x00004000,
82 |
83 | ///
84 | /// Video Graphic Adapter (VGA) monitor.
85 | ///
86 | WIN_VGA=0x00008000,
87 |
88 | ///
89 | /// National Television Systems Committee (NTSC) video standard, with a subcarrier frequency of 4.33 megahertz (MHz).
90 | ///
91 | NTSC_433=0x00010000,
92 |
93 | ///
94 | /// PAL television standard, type G.
95 | ///
96 | PAL_G=0x00020000,
97 |
98 | ///
99 | /// Phase Alternation Line (PAL) 60 video standard that is used to play NTSC video.
100 | ///
101 | PAL_60=0x00040000,
102 |
103 | ///
104 | /// SECAM television standard, type L1.
105 | ///
106 | SECAM_L1=0x00080000,
107 | }
108 | }
109 |
--------------------------------------------------------------------------------
/GDI/Defines/StockObjectType.cs:
--------------------------------------------------------------------------------
1 | namespace Win32
2 | {
3 | ///
4 | /// Types of stock objects.
5 | ///
6 | public enum StockObjectType
7 | {
8 | ///
9 | /// White brush.
10 | ///
11 | WHITE_BRUSH=0,
12 |
13 | ///
14 | /// Light gray brush.
15 | ///
16 | LTGRAY_BRUSH=1,
17 |
18 | ///
19 | /// Gray brush.
20 | ///
21 | GRAY_BRUSH=2,
22 |
23 | ///
24 | /// Dark gray brush.
25 | ///
26 | DKGRAY_BRUSH=3,
27 |
28 | ///
29 | /// Black brush.
30 | ///
31 | BLACK_BRUSH=4,
32 |
33 | ///
34 | /// Null brush (equivalent to ).
35 | ///
36 | NULL_BRUSH=5,
37 |
38 | ///
39 | /// Hollow brush (equivalent to ).
40 | ///
41 | HOLLOW_BRUSH=NULL_BRUSH,
42 |
43 | ///
44 | /// White pen.
45 | ///
46 | WHITE_PEN=6,
47 |
48 | ///
49 | /// Black pen.
50 | ///
51 | BLACK_PEN=7,
52 |
53 | ///
54 | /// Null pen. The null pen draws nothing.
55 | ///
56 | NULL_PEN=8,
57 |
58 | ///
59 | /// Original equipment manufacturer (OEM) dependent fixed-pitch (monospace) font.
60 | ///
61 | OEM_FIXED_FONT=10,
62 |
63 | ///
64 | /// Windows fixed-pitch (monospace) system font.
65 | ///
66 | ANSI_FIXED_FONT=11,
67 |
68 | ///
69 | /// Windows variable-pitch (proportional space) system font.
70 | ///
71 | ANSI_VAR_FONT=12,
72 |
73 | ///
74 | /// System font. By default, the system uses the system font to draw menus, dialog box controls, and text.
75 | ///
76 | SYSTEM_FONT=13,
77 |
78 | ///
79 | /// Device-dependent font.
80 | ///
81 | DEVICE_DEFAULT_FONT=14,
82 |
83 | ///
84 | /// Default palette. This palette consists of the static colors in the system palette.
85 | ///
86 | DEFAULT_PALETTE=15,
87 |
88 | ///
89 | /// Fixed-pitch (monospace) system font.
90 | ///
91 | SYSTEM_FIXED_FONT=16,
92 |
93 | ///
94 | /// Default font for user interface objects such as menus and dialog boxes.
95 | ///
96 | DEFAULT_GUI_FONT=17,
97 |
98 | ///
99 | /// Solid color brush. The default color is white. The color can be changed by using the function.
100 | ///
101 | DC_BRUSH=18,
102 |
103 | ///
104 | /// Solid pen color. The default color is white. The color can be changed by using the function.
105 | ///
106 | DC_PEN=19,
107 | }
108 | }
109 |
--------------------------------------------------------------------------------
/GDI/Structs/LogFont.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.InteropServices;
2 |
3 | namespace Win32
4 | {
5 | ///
6 | /// Defines the attributes of a font. (Use only in environments that have == 2.)
7 | ///
8 | [StructLayout(LayoutKind.Sequential, CharSet=CharSet.Unicode)]
9 | public class LogFont
10 | {
11 | ///
12 | /// Constant specifying the length of the character array holding .
13 | ///
14 | public const int LF_FACESIZE=32;
15 |
16 | ///
17 | /// The height, in logical units, of the font's character cell or character.
18 | ///
19 | public int lfHeight;
20 |
21 | ///
22 | /// The average width, in logical units, of characters in the requested font.
23 | ///
24 | public int lfWidth;
25 |
26 | ///
27 | /// The angle, in tenths of degrees, between the escapement vector and the x-axis of the device. The escapement vector is parallel to the base line of a row of text.
28 | ///
29 | public int lfEscapement;
30 |
31 | ///
32 | /// The angle, in tenths of degrees, between each character's base line and the x-axis of the device.
33 | ///
34 | public int lfOrientation;
35 |
36 | ///
37 | /// The weight of the font in the range 0 through 1000. For example, 400 is normal and 700 is bold. If this value is zero, a default weight is used.
38 | ///
39 | public int lfWeight;
40 |
41 | ///
42 | /// true if the font is italic.
43 | ///
44 | [MarshalAs(UnmanagedType.U1)]
45 | public bool lfItalic;
46 |
47 | ///
48 | /// true if the font is underlined.
49 | ///
50 | [MarshalAs(UnmanagedType.U1)]
51 | public bool lfUnderline;
52 |
53 | ///
54 | /// true if the font is striked out.
55 | ///
56 | [MarshalAs(UnmanagedType.U1)]
57 | public bool lfStrikeOut;
58 |
59 | ///
60 | /// A specifying the character set.
61 | ///
62 | public LogFontCharSet lfCharSet;
63 |
64 | ///
65 | /// A specifying the output precision.
66 | ///
67 | public LogFontPrecision lfOutPrecision;
68 |
69 | ///
70 | /// A specifying the clip precision.
71 | ///
72 | public LogFontClipPrecision lfClipPrecision;
73 |
74 | ///
75 | /// A specifying the quality.
76 | ///
77 | public LogFontQuality lfQuality;
78 |
79 | ///
80 | /// A specifying the pitch and font family.
81 | ///
82 | public LogFontPitchAndFamily lfPitchAndFamily;
83 |
84 | ///
85 | /// String that specifying the typeface name of the font.
86 | ///
87 | [MarshalAs(UnmanagedType.ByValTStr, SizeConst=LF_FACESIZE)]
88 | public string lfFaceName=string.Empty;
89 | }
90 | }
91 |
--------------------------------------------------------------------------------
/GDI/GDI.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.InteropServices;
2 | using System.Security;
3 | using HANDLE=System.IntPtr;
4 | using HDC=System.IntPtr;
5 |
6 | namespace Win32
7 | {
8 | ///
9 | /// Native GDI calls.
10 | ///
11 | [SuppressUnmanagedCodeSecurity]
12 | public static class GDI
13 | {
14 | const string DLLName="GDI32.dll";
15 |
16 | ///
17 | /// Selects an object into the specified device context. The new object replaces the previous object of the same type.
18 | ///
19 | /// The handle to the device context.
20 | /// The handle to the object to be selected.
21 | /// If the selected object is not a region and the function succeeds, the return value is a handle to the object being replaced. Otherwise HGDI_ERROR (-1) is returned.
22 | [DllImport(DLLName)]
23 | public static extern HANDLE SelectObject(HDC hdc, HANDLE hgdiobj);
24 |
25 | ///
26 | /// Deletes on object.
27 | ///
28 | /// The handle to the object to be deleted.
29 | /// true if the function succeeds, otherwise false is returned.
30 | [DllImport(DLLName)]
31 | public static extern bool DeleteObject(HANDLE hObject);
32 |
33 | ///
34 | /// Retrieves a handle to one of the stock pens, brushes, fonts, or palettes.
35 | ///
36 | /// The type of the stock object.
37 | /// The handle to the requested object.
38 | [DllImport(DLLName)]
39 | public static extern HANDLE GetStockObject(StockObjectType fnObject);
40 |
41 | ///
42 | /// Sets the current device context (DC) brush color to the specified color value. If the device cannot represent the specified color value, the color is set to the nearest physical color.
43 | ///
44 | /// The handle to the device context.
45 | /// The new brush color.
46 | /// If the function succeeds, the return value specifies the previous DC brush color value. Otherwise is returned.
47 | [DllImport(DLLName)]
48 | public static extern uint SetDCBrushColor(HDC hdc, uint crColor);
49 |
50 | ///
51 | /// Sets the current device context (DC) pen color to the specified color value. If the device cannot represent the specified color value, the color is set to the nearest physical color.
52 | ///
53 | /// The handle to the device context.
54 | /// The new pen color.
55 | /// If the function succeeds, the return value specifies the previous DC pen color value. Otherwise is returned.
56 | [DllImport(DLLName)]
57 | public static extern uint SetDCPenColor(HDC hdc, uint crColor);
58 |
59 | ///
60 | /// Error color value, returned by and .
61 | ///
62 | public const uint CLR_INVALID=0xFFFFFFFF;
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/IO/RawInput/Defines/RI_MOUSE.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Win32.IO.RawInput
4 | {
5 | ///
6 | /// Defines the transition state of the mouse buttons.
7 | ///
8 | [CLSCompliant(false)]
9 | [Flags]
10 | public enum RI_MOUSE : ushort
11 | {
12 | ///
13 | /// Left button changed to down.
14 | ///
15 | LEFT_BUTTON_DOWN=0x0001,
16 |
17 | ///
18 | /// Left button changed to up.
19 | ///
20 | LEFT_BUTTON_UP=0x0002,
21 |
22 | ///
23 | /// Right button changed to down.
24 | ///
25 | RIGHT_BUTTON_DOWN=0x0004,
26 |
27 | ///
28 | /// Right button changed to up.
29 | ///
30 | RIGHT_BUTTON_UP=0x0008,
31 |
32 | ///
33 | /// Middle button changed to down.
34 | ///
35 | MIDDLE_BUTTON_DOWN=0x0010,
36 |
37 | ///
38 | /// Middle button changed to up.
39 | ///
40 | MIDDLE_BUTTON_UP=0x0020,
41 |
42 | ///
43 | /// XBUTTON1 changed to down.
44 | ///
45 | XBUTTON1_DOWN=0x0040,
46 |
47 | ///
48 | /// XBUTTON1 changed to up.
49 | ///
50 | XBUTTON1_UP=0x0080,
51 |
52 | ///
53 | /// XBUTTON2 changed to down.
54 | ///
55 | XBUTTON2_DOWN=0x0100,
56 |
57 | ///
58 | /// XBUTTON2 changed to up.
59 | ///
60 | XBUTTON2_UP=0x0200,
61 |
62 | ///
63 | /// Raw input comes from a mouse wheel. The wheel delta is stored in .
64 | ///
65 | WHEEL=0x0400,
66 |
67 | ///
68 | /// Raw input comes from a horizontal mouse wheel. The wheel delta is stored in .
69 | ///
70 | HORIZONTAL_WHEEL=0x0800,
71 |
72 | #region Button 1..5 aliases
73 | ///
74 | /// Button 1 changed to down.
75 | ///
76 | BUTTON_1_DOWN=LEFT_BUTTON_DOWN,
77 |
78 | ///
79 | /// Button 1 changed to up.
80 | ///
81 | BUTTON_1_UP=LEFT_BUTTON_UP,
82 |
83 | ///
84 | /// Button 2 changed to down.
85 | ///
86 | BUTTON_2_DOWN=RIGHT_BUTTON_DOWN,
87 |
88 | ///
89 | /// Button 2 changed to up.
90 | ///
91 | BUTTON_2_UP=RIGHT_BUTTON_UP,
92 |
93 | ///
94 | /// Button 3 changed to down.
95 | ///
96 | BUTTON_3_DOWN=MIDDLE_BUTTON_DOWN,
97 |
98 | ///
99 | /// Button 3 changed to up.
100 | ///
101 | BUTTON_3_UP=MIDDLE_BUTTON_UP,
102 |
103 | ///
104 | /// Button 4 changed to down.
105 | ///
106 | BUTTON_4_DOWN=XBUTTON1_DOWN,
107 |
108 | ///
109 | /// Button 4 changed to up.
110 | ///
111 | BUTTON_4_UP=XBUTTON1_UP,
112 |
113 | ///
114 | /// Button 5 changed to down.
115 | ///
116 | BUTTON_5_DOWN=XBUTTON2_DOWN,
117 |
118 | ///
119 | /// Button 5 changed to up.
120 | ///
121 | BUTTON_5_UP=XBUTTON2_UP,
122 | #endregion
123 | }
124 | }
125 |
--------------------------------------------------------------------------------
/IO/Defines/FILE_FLAG.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Win32.IO
4 | {
5 | ///
6 | /// Defines the file flags used by some file functions.
7 | ///
8 | [CLSCompliant(false)]
9 | [Flags]
10 | public enum FILE_FLAG : uint
11 | {
12 | ///
13 | /// The file is being opened and an opportunistic lock (oplock) on the file is being requested
14 | /// as a single atomic operation. The file system checks for oplocks before it performs the
15 | /// create operation, and will fail the create with a last error code of
16 | /// ERROR_CANNOT_BREAK_OPLOCK if the result would
17 | /// be to break an existing oplock.
18 | ///
19 | OPEN_REQUIRING_OPLOCK=0x00040000,
20 |
21 | ///
22 | /// If you attempt to create multiple instances of a pipe with this flag, creation of the
23 | /// first instance succeeds, but creation of the next instance fails with
24 | /// ERROR_ACCESS_DENIED.
25 | ///
26 | /// Note: This flag is not supported until Windows 2000 SP2 and Windows XP.
27 | FIRST_PIPE_INSTANCE=0x00080000,
28 |
29 | ///
30 | /// Used with remote storage systems. File data is requested, but it should stay in remote storage.
31 | ///
32 | OPEN_NO_RECALL=0x00100000,
33 |
34 | ///
35 | /// Disables reparse point processing and opens the reparse point itself, if one.
36 | ///
37 | OPEN_REPARSE_POINT=0x00200000,
38 |
39 | //reserved_0x00400000=0x00400000,
40 |
41 | ///
42 | /// The file or device is being opened with session awareness.
43 | ///
44 | /// This flag is supported only on server editions of Windows.
45 | /// Note: This flag is not supported until Windows Server 2012.
46 | SESSION_AWARE=0x00800000,
47 |
48 | ///
49 | /// Use POSIX rules for file access.
50 | ///
51 | POSIX_SEMANTICS=0x01000000,
52 |
53 | ///
54 | /// The file or directory is being opened or created for a backup or restore operation.
55 | ///
56 | BACKUP_SEMANTICS=0x02000000,
57 |
58 | ///
59 | /// The file is to be deleted immediately after it is closed.
60 | ///
61 | DELETE_ON_CLOSE=0x04000000,
62 |
63 | ///
64 | /// Access is intended to be sequential from beginning to end. Hints the system for caching optimizations.
65 | ///
66 | SEQUENTIAL_SCAN=0x08000000,
67 |
68 | ///
69 | /// Access is intended to be random. Hints the system for caching optimizations.
70 | ///
71 | RANDOM_ACCESS=0x10000000,
72 |
73 | ///
74 | /// The file or device is being opened with no system caching for data reads and writes.
75 | ///
76 | NO_BUFFERING=0x20000000,
77 |
78 | ///
79 | /// The file or device is being opened or created for asynchronous I/O.
80 | ///
81 | OVERLAPPED=0x40000000,
82 |
83 | ///
84 | /// Write operations will not go through any intermediate cache, they will go directly to mass storage.
85 | ///
86 | WRITE_THROUGH=0x80000000,
87 | }
88 | }
89 |
--------------------------------------------------------------------------------
/Window/Defines/CS.cs:
--------------------------------------------------------------------------------
1 | namespace Win32
2 | {
3 | ///
4 | /// Window class styles.
5 | ///
6 | public static class CS
7 | {
8 | ///
9 | /// Redraws the entire window if a movement or size adjustment changes the height of the client area.
10 | ///
11 | public const int VREDRAW=0x00000001;
12 |
13 | ///
14 | /// Redraws the entire window if a movement or size adjustment changes the width of the client area.
15 | ///
16 | public const int HREDRAW=0x00000002;
17 |
18 | ///
19 | /// Undocumented.
20 | ///
21 | public const int KEYCVTWINDOW=0x00000004;
22 |
23 | ///
24 | /// Sends a double-click message to the window procedure when the user double-clicks the mouse
25 | /// while the cursor is within a window belonging to the class.
26 | ///
27 | public const int DBLCLKS=0x00000008;
28 |
29 | ///
30 | /// Reserved.
31 | ///
32 | public const int h10=0x00000010;
33 |
34 | ///
35 | /// Allocates a unique device context for each window in the class.
36 | ///
37 | public const int OWNDC=0x00000020;
38 |
39 | ///
40 | /// Allocates one device context to be shared by all windows in the class.
41 | ///
42 | public const int CLASSDC=0x00000040;
43 |
44 | ///
45 | /// Sets the clipping rectangle of the child window to that of the parent window so that the
46 | /// child can draw on the parent.
47 | ///
48 | public const int PARENTDC=0x00000080;
49 |
50 | ///
51 | /// Undocumented.
52 | ///
53 | public const int NOKEYCVT=0x00000100;
54 |
55 | ///
56 | /// Disables Close on the window menu.
57 | ///
58 | public const int NOCLOSE=0x00000200;
59 |
60 | ///
61 | /// Reserved.
62 | ///
63 | public const int h400=0x00000400;
64 |
65 | ///
66 | /// Saves, as a bitmap, the portion of the screen image obscured by a window of this class.
67 | ///
68 | public const int SAVEBITS=0x00000800;
69 |
70 | ///
71 | /// Aligns the window's client area on a byte boundary (in the x direction).
72 | /// This style affects the width of the window and its horizontal placement on the display.
73 | ///
74 | public const int BYTEALIGNCLIENT=0x00001000;
75 |
76 | ///
77 | /// Aligns the window on a byte boundary (in the x direction). This style affects the width
78 | /// of the window and its horizontal placement on the display.
79 | ///
80 | public const int BYTEALIGNWINDOW=0x00002000;
81 |
82 | ///
83 | /// Indicates that the window class is an application global class.
84 | ///
85 | public const int GLOBALCLASS=0x00004000;
86 |
87 | ///
88 | /// Reserved.
89 | ///
90 | public const int h8000=0x00008000;
91 |
92 | ///
93 | /// Undocumented.
94 | ///
95 | public const int IME=0x00010000;
96 |
97 | ///
98 | /// Enables the drop shadow effect on a window.
99 | ///
100 | public const int DROPSHADOW=0x00020000;
101 | }
102 | }
103 |
--------------------------------------------------------------------------------
/WinKernel/Defines/ACCESS_MASK.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Win32
4 | {
5 | ///
6 | /// Defines the access mask.
7 | ///
8 | ///
9 | /// A uint combining different rights.
10 | /// Generic access rights are stored in the four uppermost bits (bits 28-31).
11 | /// The SACL access right is stored in bit 24.
12 | /// Standard access rights are stored in the bits 16-23.
13 | /// Specific (access) rights are stored in the lowermost bits 0-15.
14 | /// The values in this enum are provided for simpler use of the acces mask. Just OR
15 | /// them together to your needs.
16 | ///
17 | [CLSCompliant(false)]
18 | [Flags]
19 | public enum ACCESS_MASK : uint
20 | {
21 | #region Generic access rights
22 | ///
23 | /// Read access
24 | ///
25 | GENERIC_READ=0x80000000,
26 |
27 | ///
28 | /// Write access
29 | ///
30 | GENERIC_WRITE=0x40000000,
31 |
32 | ///
33 | /// Execute access
34 | ///
35 | GENERIC_EXECUTE=0x20000000,
36 |
37 | ///
38 | /// All possible access rights
39 | ///
40 | GENERIC_ALL=0x10000000,
41 | #endregion
42 |
43 | ///
44 | /// SACL access right
45 | ///
46 | ACCESS_SYSTEM_SECURITY=0x01000000,
47 |
48 | #region Standard access rights
49 | ///
50 | /// The right to delete the object.
51 | ///
52 | DELETE=0x00010000,
53 |
54 | ///
55 | /// The right to read the information in the object's security descriptor,
56 | /// not including the information in the system access control list (SACL).
57 | ///
58 | READ_CONTROL=0x00020000,
59 |
60 | ///
61 | /// The right to modify the discretionary access control list (DACL) in
62 | /// the object's security descriptor.
63 | ///
64 | WRITE_DAC=0x00040000,
65 |
66 | ///
67 | /// The right to change the owner in the object's security descriptor.
68 | ///
69 | WRITE_OWNER=0x00080000,
70 |
71 | ///
72 | /// The right to use the object for synchronization. This enables a
73 | /// thread to wait until the object is in the signaled state. Some object
74 | /// types do not support this access right.
75 | ///
76 | SYNCHRONIZE=0x00100000,
77 |
78 | ///
79 | /// Combines , , and access.
80 | ///
81 | STANDARD_RIGHTS_REQUIRED=WRITE_OWNER|WRITE_DAC|READ_CONTROL|DELETE,
82 |
83 | ///
84 | /// Currently defined to equal .
85 | ///
86 | STANDARD_RIGHTS_READ=READ_CONTROL,
87 |
88 | ///
89 | /// Currently defined to equal .
90 | ///
91 | STANDARD_RIGHTS_WRITE=READ_CONTROL,
92 |
93 | ///
94 | /// Currently defined to equal .
95 | ///
96 | STANDARD_RIGHTS_EXECUTE=READ_CONTROL,
97 |
98 | ///
99 | /// Combines , , , and access.
100 | ///
101 | STANDARD_RIGHTS_ALL=SYNCHRONIZE|WRITE_OWNER|WRITE_DAC|READ_CONTROL|DELETE,
102 | #endregion
103 |
104 | ///
105 | /// Mask for specific rights.
106 | ///
107 | SPECIFIC_RIGHTS_ALL=0x0000FFFF,
108 |
109 | ///
110 | /// Maximum allowed access type.
111 | ///
112 | MAXIMUM_ALLOWED=0x02000000,
113 | }
114 | }
115 |
--------------------------------------------------------------------------------
/Window/Defines/HT.cs:
--------------------------------------------------------------------------------
1 | namespace Win32
2 | {
3 | ///
4 | /// Indicates the position of the cursor hot spot.
5 | ///
6 | public enum HT : int
7 | {
8 | ///
9 | /// On the screen background or on a dividing line between windows (same as , except that the DefWindowProc function produces a system beep to indicate an error).
10 | ///
11 | ERROR=-2,
12 |
13 | ///
14 | /// In a window currently covered by another window in the same thread (the message will be sent to underlying windows in the same thread until one of them returns a code that is not ).
15 | ///
16 | TRANSPARENT=-1,
17 |
18 | ///
19 | /// On the screen background or on a dividing line between windows.
20 | ///
21 | NOWHERE=0,
22 |
23 | ///
24 | /// In a client area.
25 | ///
26 | CLIENT=1,
27 |
28 | ///
29 | /// In a title bar.
30 | ///
31 | CAPTION=2,
32 |
33 | ///
34 | /// In a window menu or in a Close button in a child window.
35 | ///
36 | SYSMENU=3,
37 |
38 | ///
39 | /// In a size box (same as ).
40 | ///
41 | GROWBOX=4,
42 |
43 | ///
44 | /// In a size box (same as ).
45 | ///
46 | SIZE=4,
47 |
48 | ///
49 | /// In a menu.
50 | ///
51 | MENU=5,
52 |
53 | ///
54 | /// In a horizontal scroll bar.
55 | ///
56 | HSCROLL=6,
57 |
58 | ///
59 | /// In the vertical scroll bar.
60 | ///
61 | VSCROLL=7,
62 |
63 | ///
64 | /// In a Minimize button.
65 | ///
66 | MINBUTTON=8,
67 |
68 | ///
69 | /// In a Minimize button.
70 | ///
71 | REDUCE=8,
72 |
73 | ///
74 | /// In a Maximize button.
75 | ///
76 | MAXBUTTON=9,
77 |
78 | ///
79 | /// In a Maximize button.
80 | ///
81 | ZOOM=9,
82 |
83 | ///
84 | /// In the left border of a resizable window (the user can click the mouse to resize the window horizontally).
85 | ///
86 | LEFT=10,
87 |
88 | ///
89 | /// In the right border of a resizable window (the user can click the mouse to resize the window horizontally).
90 | ///
91 | RIGHT=11,
92 |
93 | ///
94 | /// In the upper-horizontal border of a window.
95 | ///
96 | TOP=12,
97 |
98 | ///
99 | /// In the upper-left corner of a window border.
100 | ///
101 | TOPLEFT=13,
102 |
103 | ///
104 | /// In the upper-right corner of a window border.
105 | ///
106 | TOPRIGHT=14,
107 |
108 | ///
109 | /// In the lower-horizontal border of a resizable window (the user can click the mouse to resize the window vertically).
110 | ///
111 | BOTTOM=15,
112 |
113 | ///
114 | /// In the lower-left corner of a border of a resizable window (the user can click the mouse to resize the window diagonally).
115 | ///
116 | BOTTOMLEFT=16,
117 |
118 | ///
119 | /// In the lower-right corner of a border of a resizable window (the user can click the mouse to resize the window diagonally).
120 | ///
121 | BOTTOMRIGHT=17,
122 |
123 | ///
124 | /// In the border of a window that does not have a sizing border.
125 | ///
126 | BORDER=18,
127 |
128 | ///
129 | /// In a Close button.
130 | ///
131 | CLOSE=20,
132 |
133 | ///
134 | /// In a Help button.
135 | ///
136 | HELP=21,
137 | }
138 | }
139 |
--------------------------------------------------------------------------------
/IO/HumanInterfaceDevices/Defines/HID_USAGE_GAME.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Win32.IO.HumanInterfaceDevices
4 | {
5 | ///
6 | /// Defines the usage of "Human Interface Devices" on Usage Page 5 (Game Controls)
7 | ///
8 | [CLSCompliant(false)]
9 | public static class HID_USAGE_GAME
10 | {
11 | ///
12 | /// Undefined
13 | ///
14 | public const ushort UNDEFINED=0x00;
15 |
16 | ///
17 | /// 3D Game Controller
18 | ///
19 | public const ushort D3_GAME=0x01;
20 |
21 | ///
22 | /// Pinball Device
23 | ///
24 | public const ushort PINBALL=0x02;
25 |
26 | ///
27 | /// Gun Device
28 | ///
29 | public const ushort GUN=0x03;
30 |
31 | //public const ushort reserved=0x04;
32 | //...
33 | //public const ushort reserved=0x2f;
34 |
35 | ///
36 | /// Point of View
37 | ///
38 | public const ushort POINT_OF_VIEW=0x20;
39 |
40 | ///
41 | /// Turn Right/Left
42 | ///
43 | public const ushort TURN=0x21;
44 |
45 | ///
46 | /// Pitch Right/Left
47 | ///
48 | public const ushort PITCH=0x22;
49 |
50 | ///
51 | /// Roll Forward/Backward
52 | ///
53 | public const ushort ROLL=0x23;
54 |
55 | ///
56 | /// Move Right/Left
57 | ///
58 | public const ushort MOVE_RIGHT_LEFT=0x24;
59 |
60 | ///
61 | /// Move Forward/Backward
62 | ///
63 | public const ushort MOVE_FORWARD_BACKWARD=0x25;
64 |
65 | ///
66 | /// Move Up/Down
67 | ///
68 | public const ushort MOVE_UP_DOWN=0x26;
69 |
70 | ///
71 | /// Lean Right/Left
72 | ///
73 | public const ushort LEAN_RIGHT_LEFT=0x27;
74 |
75 | ///
76 | /// Lean Forward/Backward
77 | ///
78 | public const ushort LEAN_FORWARD_BACKWARD=0x28;
79 |
80 | ///
81 | /// Height of POV
82 | ///
83 | public const ushort HEIGHT_OF_POV=0x29;
84 |
85 | ///
86 | /// Flipper
87 | ///
88 | public const ushort FLIPPER=0x2A;
89 |
90 | ///
91 | /// Secondary Flipper
92 | ///
93 | public const ushort SECONDARY_FLIPPER=0x2B;
94 |
95 | ///
96 | /// Bump
97 | ///
98 | public const ushort BUMP=0x2C;
99 |
100 | ///
101 | /// New Game
102 | ///
103 | public const ushort NEW_GAME=0x2D;
104 |
105 | ///
106 | /// Shoot Ball
107 | ///
108 | public const ushort SHOOT_BALL=0x2E;
109 |
110 | ///
111 | /// Player
112 | ///
113 | public const ushort PLAYER=0x2F;
114 |
115 | ///
116 | /// Gun Bolt
117 | ///
118 | public const ushort GUN_BOLT=0x30;
119 |
120 | ///
121 | /// Gun Clip
122 | ///
123 | public const ushort GUN_CLIP=0x31;
124 |
125 | ///
126 | /// Gun Selector
127 | ///
128 | public const ushort GUN_SELECTOR=0x32;
129 |
130 | ///
131 | /// Gun Single Shot
132 | ///
133 | public const ushort GUN_SINGLE_SHOT=0x33;
134 |
135 | ///
136 | /// Gun Burst
137 | ///
138 | public const ushort GUN_BURST=0x34;
139 |
140 | ///
141 | /// Gun Automatic
142 | ///
143 | public const ushort GUN_AUTOMATIC=0x35;
144 |
145 | ///
146 | /// Gun Safety
147 | ///
148 | public const ushort GUN_SAFETY=0x36;
149 |
150 | ///
151 | /// Gamepad Fire/Jump
152 | ///
153 | public const ushort GAMEPAD_FIRE_JUMP=0x37;
154 |
155 | ///
156 | /// Gamepad Trigger
157 | ///
158 | public const ushort GAMEPAD_TRIGGER=0x39;
159 |
160 | //public const ushort reserved=0x3a;
161 | //...
162 | //public const ushort reserved=0xffff;
163 | }
164 | }
165 |
--------------------------------------------------------------------------------
/GDI/Structs/VideoParameters.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Win32
4 | {
5 | ///
6 | /// This structure contains information for a video connection.
7 | ///
8 | public struct VideoParameters
9 | {
10 | ///
11 | /// Globally unique identifier (GUID) for this structure, {02C62061-1097-11d1-920F-00A024DF156E}.
12 | /// Display drivers should verify the GUID before processing the structure.
13 | ///
14 | public Guid guid;
15 |
16 | ///
17 | /// Reserved; must be zero.
18 | ///
19 | public uint dwOffset;
20 |
21 | ///
22 | /// Specifies whether to retrieve or set the values that the other members of this structure specify.
23 | ///
24 | public VP_COMMAND dwCommand;
25 |
26 | ///
27 | /// Indicates the members that contain valid data.
28 | ///
29 | public VP_FLAGS dwFlags;
30 |
31 | ///
32 | /// Specifies the current playback mode.
33 | ///
34 | public VP_MODE dwMode;
35 |
36 | ///
37 | /// Specifies the television standard.
38 | ///
39 | public VP_TV_STANDARD dwTVStandard;
40 |
41 | ///
42 | /// Specifies the modes that are available.
43 | ///
44 | public uint dwAvailableModes;
45 |
46 | ///
47 | /// Specifies the TV standards that are available.
48 | ///
49 | public uint dwAvailableTVStandard;
50 |
51 | ///
52 | /// Specifies the flicker reduction provided by the hardware.
53 | ///
54 | public uint dwFlickerFilter;
55 |
56 | ///
57 | /// Specifies the amount of overscan in the horizontal direction.
58 | ///
59 | public uint dwOverScanX;
60 |
61 | ///
62 | /// Specifies the amount of overscan in the vertical direction.
63 | ///
64 | public uint dwOverScanY;
65 |
66 | ///
67 | /// Specifies the maximum horizontal resolution, in pixels, that is supported when the video is not scaled.
68 | ///
69 | public uint dwMaxUnscaledX;
70 |
71 | ///
72 | /// Specifies the maximum vertical resolution, in pixels, that is supported when the video is not scaled.
73 | ///
74 | public uint dwMaxUnscaledY;
75 |
76 | ///
77 | /// pecifies the horizontal adjustment to the center of the image, in scan lines.
78 | ///
79 | public uint dwPositionX;
80 |
81 | ///
82 | /// pecifies the vertical adjustment to the center of the image, in scan lines.
83 | ///
84 | public uint dwPositionY;
85 |
86 | ///
87 | /// Specifies the direct current (DC) offset of the video signal to increase brightness on the television.
88 | ///
89 | public uint dwBrightness;
90 |
91 | ///
92 | /// Specifies to the gain of the video signal to increase the intensity of whiteness on the television.
93 | ///
94 | public uint dwContrast;
95 |
96 | ///
97 | /// Specifies the copy protection type.
98 | ///
99 | public VP_CP_TYPE dwCPType;
100 |
101 | ///
102 | /// Specifies the copy protection command.
103 | ///
104 | public VP_CP_CMD dwCPCommand;
105 |
106 | ///
107 | /// Specifies TV standards for which copy protection types are available.
108 | ///
109 | public uint dwCPStandard;
110 |
111 | ///
112 | /// Specifies the copy protection key returned if is set to .
113 | ///
114 | public uint dwCPKey;
115 |
116 | ///
117 | /// Specifies the digital video disc (DVD) analog protection system (APS) trigger bit value.
118 | ///
119 | public uint bCP_APSTriggerBits;
120 |
121 | ///
122 | /// Specifies the OEM-specific copy protection data.
123 | ///
124 | public unsafe fixed byte bOEMCopyProtection[256];
125 | }
126 | }
127 |
--------------------------------------------------------------------------------
/GDI/DeviceContext.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.InteropServices;
3 | using System.Security;
4 | using HDC=System.IntPtr;
5 |
6 | namespace Win32
7 | {
8 | ///
9 | /// Class containing function of the GDI relevant for OpenGL initialization.
10 | ///
11 | [SuppressUnmanagedCodeSecurity]
12 | public static class DeviceContext
13 | {
14 | const string DLLName="GDI32.dll";
15 |
16 | ///
17 | /// Attempts to match an appropriate pixel format supported by a device context to a given pixel format specification.
18 | ///
19 | /// The handle to the device context.
20 | /// A structure specifying the pixel format.
21 | /// must be initialized with the size of .
22 | /// If successful the pixel format (greater zero), ohterwise 0 (zero) is returned.
23 | [DllImport(DLLName)]
24 | public static extern int ChoosePixelFormat(HDC hdc, ref PixelFormatDescriptor ppfd);
25 |
26 | ///
27 | /// Obtains information about the pixel format.
28 | ///
29 | /// The handle to the device context.
30 | /// The pixel format.
31 | /// The size of the structure pointed to by ().
32 | /// Returns the pixel format specification.
33 | /// If the function succeeds, the return value is the maximum pixel format index of
34 | /// the device context, otherwise 0 (zero) is returned.
35 | [DllImport(DLLName)]
36 | public static extern int DescribePixelFormat(HDC hdc, int iPixelFormat, uint nBytes, out PixelFormatDescriptor ppfd);
37 |
38 | ///
39 | /// Obtains information about the pixel format.
40 | ///
41 | /// The handle to the device context.
42 | /// The pixel format.
43 | /// The size of the structure pointed to by ().
44 | /// Returns the pixel format specification. Set 0 (zero) if only the maximum pixel format index of the device context is to be returned.
45 | /// If the function succeeds, the return value is the maximum pixel format index of
46 | /// the device context, otherwise 0 (zero) is returned.
47 | [DllImport(DLLName)]
48 | public static extern int DescribePixelFormat(HDC hdc, int iPixelFormat, uint nBytes, IntPtr ppfd);
49 |
50 | ///
51 | /// Sets the pixel format of a device context. This is possible only once!
52 | ///
53 | /// The handle to the device context.
54 | /// The pixel format.
55 | /// >A structure specifying the pixel format.
56 | /// must be initialized with the size of .
57 | /// true if the function succeeds, otherwise false.
58 | [DllImport(DLLName)]
59 | public static extern bool SetPixelFormat(HDC hdc, int iPixelFormat, ref PixelFormatDescriptor ppfd);
60 |
61 | ///
62 | /// Returns the index of the pixel format currently used by a device context.
63 | ///
64 | /// The handle to the device context.
65 | /// The pixel format.
66 | [DllImport(DLLName)]
67 | public static extern int GetPixelFormat(HDC hdc);
68 |
69 | ///
70 | /// Swaps the front and back buffers of a device context.
71 | ///
72 | /// The handle to the device context.
73 | /// true if the function succeeds, otherwise false.
74 | [DllImport(DLLName)]
75 | public static extern bool SwapBuffers(HDC hdc);
76 | }
77 | }
78 |
--------------------------------------------------------------------------------
/IO/RawInput/Defines/RIDEV.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Win32.IO.RawInput
4 | {
5 | ///
6 | /// Mode flag that specifies how to interpret the information provided by
7 | /// and .
8 | ///
9 | [CLSCompliant(false)]
10 | [Flags]
11 | public enum RIDEV : uint
12 | {
13 | ///
14 | /// Default.
15 | ///
16 | NONE=0,
17 |
18 | ///
19 | /// If set, this removes the top level collection from the inclusion list. This tells the operating
20 | /// system to stop reading from a device which matches the top level collection.
21 | ///
22 | REMOVE=0x00000001,
23 |
24 | ///
25 | /// If set, this specifies the top level collections to exclude when reading a complete usage page.
26 | /// This flag only affects a TLC (top level collection) whose usage page is already specified with
27 | /// RIDEV_PAGEONLY.
28 | ///
29 | EXCLUDE=0x00000010,
30 |
31 | ///
32 | /// If set, this specifies all devices whose top level collection is from the specified
33 | /// . Note that
34 | /// must be zero. To exclude a particular top level collection, use
35 | /// RIDEV_EXCLUDE.
36 | ///
37 | PAGEONLY=0x00000020,
38 |
39 | ///
40 | /// If set, this prevents any devices specified by
41 | /// or from generating legacy messages. This is only
42 | /// for the mouse and keyboard. See Remarks.
43 | ///
44 | NOLEGACY=0x00000030,
45 |
46 | ///
47 | /// If set, this enables the caller to receive the input even when the caller is not in the
48 | /// foreground. Note that must be specified.
49 | ///
50 | INPUTSINK=0x00000100,
51 |
52 | ///
53 | /// If set, the mouse button click does not activate the other window.
54 | ///
55 | CAPTUREMOUSE=0x00000200,
56 |
57 | ///
58 | /// If set, the application-defined keyboard device hotkeys are not handled. However, the system
59 | /// hotkeys; for example, [ALT]+[TAB] and [CTRL]+[ALT]+[DEL], are still handled. By default, all
60 | /// keyboard hotkeys are handled. RIDEV_NOHOTKEYS can be specified
61 | /// even if RIDEV_NOLEGACY is not specified and
62 | /// is null (IntPtr.Zero).
63 | ///
64 | NOHOTKEYS=0x00000200,
65 |
66 | ///
67 | /// If set, the application command keys are handled. RIDEV_APPKEYS
68 | /// can be specified only if RIDEV_NOLEGACY is specified for a
69 | /// keyboard device.
70 | ///
71 | APPKEYS=0x00000400,
72 |
73 | ///
74 | /// If set, this enables the caller to receive input in the background only if the foreground
75 | /// application does not process it. In other words, if the foreground application is not registered
76 | /// for raw input, then the background application that is registered will receive the input.
77 | ///
78 | /// Windows XP: This flag is not supported until Windows Vista
79 | EXINPUTSINK=0x00001000,
80 |
81 | ///
82 | /// If set, this enables the caller to receive WM_INPUT_DEVICE_CHANGE
83 | /// notifications for device arrival and device removal. This works only when
84 | /// is also set (and of course must be specified).
85 | ///
86 | /// Windows XP: This flag is not supported until Windows Vista
87 | DEVNOTIFY=0x00002000,
88 |
89 | ///
90 | /// Usage: mode&RIDEV.EXMODEMASK.
91 | ///
92 | EXMODEMASK=0x000000F0,
93 | }
94 | }
95 |
--------------------------------------------------------------------------------
/IO/Defines/FILE_ATTRIBUTE.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Win32.IO
4 | {
5 | ///
6 | /// Defines the file attributes and flags used by some file functions.
7 | ///
8 | [CLSCompliant(false)]
9 | [Flags]
10 | public enum FILE_ATTRIBUTE : uint
11 | {
12 | ///
13 | /// A file that is read-only. Applications can read the file, but cannot write to it or delete it.
14 | ///
15 | READONLY=0x00000001,
16 |
17 | ///
18 | /// Marks a file or directory as hidden.
19 | ///
20 | HIDDEN=0x00000002,
21 |
22 | ///
23 | /// A file or directory of the operating system.
24 | ///
25 | SYSTEM=0x00000004,
26 |
27 | //reserved_0x00000008=0x00000008,
28 |
29 | ///
30 | /// Identifies a directory.
31 | ///
32 | DIRECTORY=0x00000010,
33 |
34 | ///
35 | /// Used to mark file and directories for backup.
36 | ///
37 | ARCHIVE=0x00000020,
38 |
39 | ///
40 | /// This value is reserved for system use.
41 | ///
42 | DEVICE=0x00000040,
43 |
44 | ///
45 | /// A file that does not have other attributes set. This attribute is valid only when used alone.
46 | ///
47 | NORMAL=0x00000080,
48 |
49 | ///
50 | /// Marks a file as temporary storage. The system delays writing data to mass storage, if possible,
51 | /// since the file is most likely to be delete after use.
52 | ///
53 | TEMPORARY=0x00000100,
54 |
55 | ///
56 | /// Marks a file as sparse file.
57 | ///
58 | SPARSE_FILE=0x00000200,
59 |
60 | ///
61 | /// Marks a file or directory as associated with a reparse point, or marks a file as a symbolic link.
62 | ///
63 | REPARSE_POINT=0x00000400,
64 |
65 | ///
66 | /// Marks a file or directory that is compressed.
67 | ///
68 | COMPRESSED=0x00000800,
69 |
70 | ///
71 | /// Marks a file that is moved to an offline storage and not immediately available.
72 | ///
73 | OFFLINE=0x00001000,
74 |
75 | ///
76 | /// Marks a file or directory that does not take part in content indexing.
77 | ///
78 | NOT_CONTENT_INDEXED=0x00002000,
79 |
80 | ///
81 | /// Marks a file or directory that is encrypted.
82 | ///
83 | ENCRYPTED=0x00004000,
84 |
85 | ///
86 | /// Marks a file or directory that is configured with integrity. Supported only on ReFS volumes.
87 | ///
88 | /// Note: This flag is not supported until Windows Server 2012.
89 | INTEGRITY_STREAM=0x00008000,
90 |
91 | ///
92 | /// This value is reserved for system use.
93 | ///
94 | VIRTUAL=0x00010000,
95 |
96 | ///
97 | /// The user data stream not to be read by the background data integrity scanner
98 | /// (AKA scrubber). When set on a directory it only provides inheritance. This
99 | /// flag is only supported on Storage Spaces and ReFS volumes. It is not included
100 | /// in an ordinary directory listing.
101 | ///
102 | /// Note: This flag is not supported until Windows 8 and Windows Server 2012.
103 | NO_SCRUB_DATA=0x00020000,
104 | }
105 |
106 | /*
107 | TODO:?
108 | #define FILE_CASE_SENSITIVE_SEARCH 0x00000001
109 | #define FILE_CASE_PRESERVED_NAMES 0x00000002
110 | #define FILE_UNICODE_ON_DISK 0x00000004
111 | #define FILE_PERSISTENT_ACLS 0x00000008
112 | #define FILE_FILE_COMPRESSION 0x00000010
113 | #define FILE_VOLUME_QUOTAS 0x00000020
114 | #define FILE_SUPPORTS_SPARSE_FILES 0x00000040
115 | #define FILE_SUPPORTS_REPARSE_POINTS 0x00000080
116 | #define FILE_SUPPORTS_REMOTE_STORAGE 0x00000100
117 | #define FILE_VOLUME_IS_COMPRESSED 0x00008000
118 | #define FILE_SUPPORTS_OBJECT_IDS 0x00010000
119 | #define FILE_SUPPORTS_ENCRYPTION 0x00020000
120 | #define FILE_NAMED_STREAMS 0x00040000
121 | #define FILE_READ_ONLY_VOLUME 0x00080000
122 | #define FILE_SEQUENTIAL_WRITE_ONCE 0x00100000
123 | #define FILE_SUPPORTS_TRANSACTIONS 0x00200000
124 | #define FILE_SUPPORTS_HARD_LINKS 0x00400000
125 | #define FILE_SUPPORTS_EXTENDED_ATTRIBUTES 0x00800000
126 | #define FILE_SUPPORTS_OPEN_BY_FILE_ID 0x01000000
127 | #define FILE_SUPPORTS_USN_JOURNAL 0x02000000
128 | */
129 | }
130 |
--------------------------------------------------------------------------------
/GDI/Defines/PFD.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Win32
4 | {
5 | ///
6 | /// Flags for describing a pixel format.
7 | ///
8 | [Flags]
9 | public enum PFD : uint
10 | {
11 | ///
12 | /// The buffer is double-buffered. This flag and
13 | /// are mutually exclusive in the current generic implementation.
14 | ///
15 | DOUBLEBUFFER=0x00000001,
16 |
17 | ///
18 | /// The buffer is stereoscopic. This flag is not supported in the current generic implementation.
19 | ///
20 | STEREO=0x00000002,
21 |
22 | ///
23 | /// The buffer can draw to a window or device surface.
24 | ///
25 | DRAW_TO_WINDOW=0x00000004,
26 |
27 | ///
28 | /// The buffer can draw to a memory bitmap.
29 | ///
30 | DRAW_TO_BITMAP=0x00000008,
31 |
32 | ///
33 | /// The buffer supports GDI drawing. This flag and
34 | /// are mutually exclusive in the current generic implementation.
35 | ///
36 | SUPPORT_GDI=0x00000010,
37 |
38 | ///
39 | /// The buffer supports OpenGL drawing.
40 | ///
41 | SUPPORT_OPENGL=0x00000020,
42 |
43 | ///
44 | /// The pixel format is supported by the GDI software implementation, which is
45 | /// also known as the generic implementation. If this bit is clear, the pixel
46 | /// format is supported by a device driver or hardware.
47 | ///
48 | GENERIC_FORMAT=0x00000040,
49 |
50 | ///
51 | /// The buffer uses RGBA pixels on a palette-managed device.
52 | ///
53 | NEED_PALETTE=0x00000080,
54 |
55 | ///
56 | /// Defined in the pixel format descriptors of hardware that supports one hardware palette in 256-color mode only.
57 | ///
58 | NEED_SYSTEM_PALETTE=0x00000100,
59 |
60 | ///
61 | /// Swapping the color buffers causes the exchange of the back buffer's content with the front buffer's content.
62 | ///
63 | SWAP_EXCHANGE=0x00000200,
64 |
65 | ///
66 | /// Swapping the color buffers causes the content of the back buffer to be copied to the front buffer.
67 | ///
68 | SWAP_COPY=0x00000400,
69 |
70 | ///
71 | /// Indicates whether a device can swap individual layer planes with pixel formats that
72 | /// include double-buffered overlay or underlay planes. Otherwise all layer planes are
73 | /// swapped together as a group.
74 | ///
75 | SWAP_LAYER_BUFFERS=0x00000800,
76 |
77 | ///
78 | /// The pixel format is supported by a device driver that accelerates the generic implementation (MCD).
79 | /// If this flag is clear and the flag is set, the pixel format is
80 | /// supported by the generic implementation only.
81 | ///
82 | GENERIC_ACCELERATED=0x00001000,
83 |
84 | ///
85 | /// The pixel buffer supports DirectDraw drawing, which allows applications
86 | /// to have low-level control of the output drawing surface.
87 | ///
88 | SUPPORT_DIRECTDRAW=0x00002000,
89 |
90 | ///
91 | /// The pixel buffer supports Direct3D drawing, which accellerated rendering
92 | /// in three dimensions.
93 | ///
94 | DIRECT3D_ACCELERATED=0x00004000,
95 |
96 | ///
97 | /// The pixel buffer supports compositing, which indicates that source pixels
98 | /// MAY overwrite or be combined with background pixels.
99 | ///
100 | SUPPORT_COMPOSITION=0x00008000,
101 |
102 | ///
103 | /// The requested pixel format can either have or not have a depth buffer. Only used in .
104 | ///
105 | DEPTH_DONTCARE=0x20000000,
106 |
107 | ///
108 | /// The requested pixel format can be either single- or double-buffered. Only used in .
109 | ///
110 | DOUBLEBUFFER_DONTCARE=0x40000000,
111 |
112 | ///
113 | /// The requested pixel format can be either monoscopic or stereoscopic. Only used in .
114 | ///
115 | STEREO_DONTCARE=0x80000000,
116 |
117 | ///
118 | /// Combination of , , and .
119 | ///
120 | Default=DRAW_TO_WINDOW|SUPPORT_OPENGL|DOUBLEBUFFER|SUPPORT_COMPOSITION,
121 | }
122 | }
123 |
--------------------------------------------------------------------------------
/IO/HumanInterfaceDevices/Defines/HID_USAGE_SPORT.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Win32.IO.HumanInterfaceDevices
4 | {
5 | ///
6 | /// Defines the usage of "Human Interface Devices" on Usage Page 4 (Sport Controls)
7 | ///
8 | [CLSCompliant(false)]
9 | public static class HID_USAGE_SPORT
10 | {
11 | ///
12 | /// Unidentified
13 | ///
14 | public const ushort UNIDENTIFIED=0x00;
15 |
16 | ///
17 | /// Baseball Bat
18 | ///
19 | public const ushort BASEBALL_BAT=0x01;
20 |
21 | ///
22 | /// Golf Club
23 | ///
24 | public const ushort GOLF_CLUB=0x02;
25 |
26 | ///
27 | /// Rowing Machine
28 | ///
29 | public const ushort ROWING_MACHINE=0x03;
30 |
31 | ///
32 | /// Treadmill
33 | ///
34 | public const ushort TREADMILL=0x04;
35 |
36 | //public const ushort reserved=0x05;
37 | //...
38 | //public const ushort reserved=0x2f;
39 |
40 | ///
41 | /// Oar
42 | ///
43 | public const ushort OAR=0x30;
44 |
45 | ///
46 | /// Slope
47 | ///
48 | public const ushort SLOPE=0x31;
49 |
50 | ///
51 | /// Rate
52 | ///
53 | public const ushort RATE=0x32;
54 |
55 | ///
56 | /// Stick Speed
57 | ///
58 | public const ushort STICK_SPEED=0x33;
59 |
60 | ///
61 | /// Stick Face Angle
62 | ///
63 | public const ushort STICK_FACE_ANGLE=0x34;
64 |
65 | ///
66 | /// Stick Heel/Toe
67 | ///
68 | public const ushort STICK_HEEL_TOE=0x35;
69 |
70 | ///
71 | /// Stick Follow Through
72 | ///
73 | public const ushort STICK_FOLLOW_THROUGH=0x36;
74 |
75 | ///
76 | /// Stick Tempo
77 | ///
78 | public const ushort STICK_TEMPO=0x37;
79 |
80 | ///
81 | /// Stick Type
82 | ///
83 | public const ushort STICK_TYPE=0x38;
84 |
85 | ///
86 | /// Stick Height
87 | ///
88 | public const ushort STICK_HEIGHT=0x39;
89 |
90 | //public const ushort reserved=0x3a;
91 | //...
92 | //public const ushort reserved=0x4f;
93 |
94 | ///
95 | /// Putter
96 | ///
97 | public const ushort PUTTER=0x50;
98 |
99 | ///
100 | /// 1 Iron
101 | ///
102 | public const ushort IRON_1=0x51;
103 |
104 | ///
105 | /// 2 Iron
106 | ///
107 | public const ushort IRON_2=0x52;
108 |
109 | ///
110 | /// 3 Iron
111 | ///
112 | public const ushort IRON_3=0x53;
113 |
114 | ///
115 | /// 4 Iron
116 | ///
117 | public const ushort IRON_4=0x54;
118 |
119 | ///
120 | /// 5 Iron
121 | ///
122 | public const ushort IRON_5=0x55;
123 |
124 | ///
125 | /// 6 Iron
126 | ///
127 | public const ushort IRON_6=0x56;
128 |
129 | ///
130 | /// 7 Iron
131 | ///
132 | public const ushort IRON_7=0x57;
133 |
134 | ///
135 | /// 8 Iron
136 | ///
137 | public const ushort IRON_8=0x58;
138 |
139 | ///
140 | /// 9 Iron
141 | ///
142 | public const ushort IRON_9=0x59;
143 |
144 | ///
145 | /// 10 Iron
146 | ///
147 | public const ushort IRON_10=0x5A;
148 |
149 | ///
150 | /// 11 Iron
151 | ///
152 | public const ushort IRON_11=0x5B;
153 |
154 | ///
155 | /// Sand Wedge
156 | ///
157 | public const ushort SAND_WEDGE=0x5C;
158 |
159 | ///
160 | /// Loft Wedge
161 | ///
162 | public const ushort LOFT_WEDGE=0x5D;
163 |
164 | ///
165 | /// Power Wedge
166 | ///
167 | public const ushort POWER_WEDGE=0x5E;
168 |
169 | ///
170 | /// 1 Wood
171 | ///
172 | public const ushort WOOD_1=0x5F;
173 |
174 | ///
175 | /// 3 Wood
176 | ///
177 | public const ushort WOOD_3=0x60;
178 |
179 | ///
180 | /// 5 Wood
181 | ///
182 | public const ushort WOOD_5=0x61;
183 |
184 | ///
185 | /// 7 Wood
186 | ///
187 | public const ushort WOOD_7=0x62;
188 |
189 | ///
190 | /// 9 Wood
191 | ///
192 | public const ushort WOOD_9=0x63;
193 |
194 | //public const ushort reserved=0x64;
195 | //...
196 | //public const ushort reserved=0xffff;
197 | }
198 | }
199 |
--------------------------------------------------------------------------------
/Window/Window.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.InteropServices;
2 | using System.Security;
3 | using HDC=System.IntPtr;
4 | using HRGN=System.IntPtr;
5 | using HWND=System.IntPtr;
6 |
7 | namespace Win32
8 | {
9 | ///
10 | /// Class for managing windows (not the OS, just the windows).
11 | ///
12 | [SuppressUnmanagedCodeSecurity]
13 | public static class Window
14 | {
15 | const string DLLName="User32.dll";
16 |
17 | ///
18 | /// Retrieves a handle to a device context (DC) for the client area of a specified window or for the entire screen.
19 | ///
20 | /// The handle to the window. Set to retrieve the device context of the screen.
21 | /// If successful the handle to the device context, otherwise 0 (zero) is returned.
22 | [DllImport(DLLName)]
23 | public static extern HDC GetDC(HWND hWnd);
24 |
25 | ///
26 | /// Retrieves a handle to a device context (DC) for the client area of a specified window or for the entire screen.
27 | ///
28 | /// The handle to the window. Set to retrieve the device context of the screen.
29 | /// A clipping region that may be combined with the visible region of the DC. If the value of flags is
30 | /// or , then the operating system assumes ownership of the region
31 | /// and will automatically delete it when it is no longer needed. In this case, the application should not use or delete the
32 | /// region after a successful call to .
33 | /// A -bitmask specifying how the DC is created.
34 | /// If successful the handle to the device context, otherwise 0 (zero) is returned.
35 | [DllImport(DLLName)]
36 | public static extern HDC GetDCEx(HWND hWnd, HRGN hrgnClip, DCX flags);
37 |
38 | ///
39 | /// Retrieves a handle to a device context (DC) for the entire window, including title bar, menus, and scroll bars, or of the primary monitor device.
40 | ///
41 | /// The handle to the window. Set to retrieve the device context of the primary monitor device.
42 | /// If successful the handle to the device context, otherwise 0 (zero) is returned.
43 | [DllImport(DLLName)]
44 | public static extern HDC GetWindowDC(HWND hWnd);
45 |
46 | ///
47 | /// Releases a device context (DC).
48 | ///
49 | /// The handle to the window whose DC is to be released.
50 | /// The handle to the DC to be released.
51 | /// 1 (one) if the device context was released, otherwise 0 (zero) is returned.
52 | [DllImport(DLLName)]
53 | public static extern int ReleaseDC(HWND hWnd, HDC hDC);
54 |
55 | ///
56 | /// Retrieves a handle of a window from a device context (DC).
57 | ///
58 | /// The handle to the device context.
59 | /// If successful the handle to the window, otherwise 0 (zero) is returned.
60 | [DllImport(DLLName)]
61 | public static extern HWND WindowFromDC(HDC hDC);
62 |
63 | ///
64 | /// Changes the size, position, and Z order of a child, pop-up, or top-level window.
65 | ///
66 | /// The handle to the window.
67 | /// The handle to the window to precede the positioned window in the Z order.
68 | /// Can also be one of , , and .
69 | /// The new position of the left side of the window, in client coordinates.
70 | /// The new position of the top of the window, in client coordinates.
71 | /// The new width of the window, in pixels.
72 | /// The new height of the window, in pixels.
73 | /// A specifying window sizing and positioning flags.
74 | /// true if the function succeeds, otherwise false.
75 | [DllImport(DLLName)]
76 | public static extern bool SetWindowPos(HWND hWnd, HWND hWndInsertAfter, int X, int Y, int cx, int cy, SWP uFlags);
77 |
78 | ///
79 | /// Places the window at the bottom of the Z order.
80 | ///
81 | public static readonly HWND BOTTOM=(HWND)1;
82 |
83 | ///
84 | /// Places the window at the top of the Z order.
85 | ///
86 | public static readonly HWND TOP=(HWND)0;
87 |
88 | ///
89 | /// Places the window above all non-topmost windows.
90 | ///
91 | public static readonly HWND TOPMOST=(HWND)(-1);
92 |
93 | ///
94 | /// Places the window above all non-topmost windows (that is, behind all topmost windows).
95 | ///
96 | public static readonly HWND NOTOPMOST=(HWND)(-2);
97 | }
98 | }
99 |
--------------------------------------------------------------------------------
/IO/HumanInterfaceDevices/Defines/HID_USAGE_PAGE.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Win32.IO.HumanInterfaceDevices
4 | {
5 | ///
6 | /// Defines the usage pages for "Human Interface Devices".
7 | ///
8 | [CLSCompliant(false)]
9 | public static class HID_USAGE_PAGE
10 | {
11 | ///
12 | /// Undefined
13 | ///
14 | public const ushort UNDEFINED=0x0000;
15 |
16 | ///
17 | /// Generic Desktop Controls
18 | ///
19 | public const ushort GENERIC_DESKTOP=0x0001;
20 |
21 | ///
22 | /// Simulation Controls
23 | ///
24 | public const ushort SIMULATION=0x0002;
25 |
26 | ///
27 | /// VR Controls
28 | ///
29 | public const ushort VR=0x0003;
30 |
31 | ///
32 | /// Sport Controls
33 | ///
34 | public const ushort SPORT=0x0004;
35 |
36 | ///
37 | /// Game Controls
38 | ///
39 | public const ushort GAME=0x0005;
40 |
41 | ///
42 | /// Generic Device Controls
43 | ///
44 | public const ushort GENERIC_DEVICE=0x0006;
45 |
46 | ///
47 | /// Keyboard/Keypad
48 | ///
49 | public const ushort KEYBOARD=0x0007;
50 |
51 | ///
52 | /// LEDs
53 | ///
54 | public const ushort LEDS=0x0008;
55 |
56 | ///
57 | /// Button
58 | ///
59 | public const ushort BUTTON=0x0009;
60 |
61 | ///
62 | /// Ordinal
63 | ///
64 | public const ushort ORDINAL=0x000a;
65 |
66 | ///
67 | /// Telephony
68 | ///
69 | public const ushort TELEPHONY=0x000b;
70 |
71 | ///
72 | /// Consumer
73 | ///
74 | public const ushort CONSUMER=0x000c;
75 |
76 | ///
77 | /// Digitizer
78 | ///
79 | public const ushort DIGITIZER=0x000d;
80 |
81 | //public const ushort resevered=0x000e;
82 |
83 | ///
84 | /// USB Physical Interface Devices
85 | ///
86 | public const ushort PID=0x000f;
87 |
88 | ///
89 | /// Unicode
90 | ///
91 | public const ushort UNICODE=0x0010;
92 |
93 | //public const ushort resevered=0x0011;
94 | //public const ushort resevered=0x0012;
95 | //public const ushort resevered=0x0013;
96 |
97 | ///
98 | /// Alphanumeric Display
99 | ///
100 | public const ushort ALPHANUMERIC=0x0014;
101 |
102 | //public const ushort resevered=0x0015;
103 | //...
104 | //public const ushort resevered=0x003f;
105 |
106 | ///
107 | /// Medical Instruments
108 | ///
109 | public const ushort MEDICAL=0x0040;
110 |
111 | //public const ushort resevered=0x0041;
112 | //...
113 | //public const ushort resevered=0x007f;
114 |
115 | ///
116 | /// Monitor
117 | ///
118 | public const ushort MONITOR=0x0080;
119 |
120 | ///
121 | /// Monitor Enumerated Values
122 | ///
123 | public const ushort MONITOR_ENUMERATED_VALUES=0x0081;
124 |
125 | ///
126 | /// VESA Virtual Controls
127 | ///
128 | public const ushort VESA_VIRTUAL=0x0082;
129 |
130 | ///
131 | /// VESA Command
132 | ///
133 | public const ushort VESA_COMMAND=0x0083;
134 |
135 | ///
136 | /// Power Device
137 | ///
138 | public const ushort POWER=0x0084;
139 |
140 | ///
141 | /// Battery System
142 | ///
143 | public const ushort BATTERY=0x0085;
144 |
145 | ///
146 | /// Power Page 3
147 | ///
148 | public const ushort POWER_PAGE_3=0x0086;
149 |
150 | ///
151 | /// Power Page 4
152 | ///
153 | public const ushort POWER_PAGE_4=0x0087;
154 |
155 | //public const ushort resevered=0x0088;
156 | //...
157 | //public const ushort resevered=0x008b;
158 |
159 | ///
160 | /// Bar Code Scanner
161 | ///
162 | public const ushort BAR_CODE_SCANNER=0x008c;
163 |
164 | ///
165 | /// Scale Device
166 | ///
167 | public const ushort SCALE=0x008d;
168 |
169 | ///
170 | /// Magnetic Stripe Reading (MSR) Devices
171 | ///
172 | public const ushort MSR=0x008e;
173 |
174 | ///
175 | /// Reserved Point of Sale
176 | ///
177 | public const ushort POINT_OF_SALE=0x008f;
178 |
179 | ///
180 | /// Camera Control
181 | ///
182 | public const ushort CAMERA=0x0090;
183 |
184 | ///
185 | /// Arcade Device
186 | ///
187 | public const ushort ARCADE=0x0091;
188 |
189 | //public const ushort resevered=0x0092;
190 | //...
191 | //public const ushort resevered=0xfeff;
192 |
193 | ///
194 | /// First allowed Vendor-defined usage page
195 | ///
196 | public const ushort VENDOR_DEFINED_FIRST=0xff00;
197 |
198 | ///
199 | /// Last allowed Vendor-defined usage page
200 | ///
201 | public const ushort VENDOR_DEFINED_LAST=0xffff;
202 | }
203 | }
204 |
--------------------------------------------------------------------------------
/MultiMedia/JoystickData.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Win32.MultiMedia
4 | {
5 | ///
6 | ///
7 | ///
8 | public class JoystickData : EventArgs
9 | {
10 | ///
11 | ///
12 | ///
13 | public JoystickData() { }
14 |
15 | ///
16 | ///
17 | ///
18 | ///
19 | public JoystickData(uint x)
20 | {
21 | // Default
22 | POV = 65535;
23 | POVAngle = 655.35;
24 |
25 | R = 32767;
26 | U = 32767;
27 | V = 32767;
28 | X = 32767;
29 | Y = 32767;
30 | Z = 32767;
31 |
32 | //Set Values
33 | X = x;
34 | }
35 |
36 | ///
37 | ///
38 | ///
39 | public uint ID { get; internal set; }
40 |
41 | ///
42 | ///
43 | ///
44 | public string Name { get; internal set; }
45 |
46 | ///
47 | ///
48 | ///
49 | public uint NumberOfAxes { get; internal set; }
50 |
51 | ///
52 | ///
53 | ///
54 | public uint NumberOfButtons { get; internal set; }
55 |
56 | ///
57 | ///
58 | ///
59 | public uint R { get; internal set; }
60 |
61 | ///
62 | ///
63 | ///
64 | public uint U { get; internal set; }
65 |
66 | ///
67 | ///
68 | ///
69 | public uint V { get; internal set; }
70 |
71 | ///
72 | ///
73 | ///
74 | public uint X { get; internal set; }
75 |
76 | ///
77 | ///
78 | ///
79 | public uint Y { get; internal set; }
80 |
81 | ///
82 | ///
83 | ///
84 | public uint Z { get; internal set; }
85 |
86 | ///
87 | ///
88 | ///
89 | public uint ButtonPressed { get; internal set; }
90 |
91 | ///
92 | ///
93 | ///
94 | public bool Button01 { get; internal set; }
95 |
96 | ///
97 | ///
98 | ///
99 | public bool Button02 { get; internal set; }
100 |
101 | ///
102 | ///
103 | ///
104 | public bool Button03 { get; internal set; }
105 |
106 | ///
107 | ///
108 | ///
109 | public bool Button04 { get; internal set; }
110 |
111 | ///
112 | ///
113 | ///
114 | public bool Button05 { get; internal set; }
115 |
116 | ///
117 | ///
118 | ///
119 | public bool Button06 { get; internal set; }
120 |
121 | ///
122 | ///
123 | ///
124 | public bool Button07 { get; internal set; }
125 |
126 | ///
127 | ///
128 | ///
129 | public bool Button08 { get; internal set; }
130 |
131 | ///
132 | ///
133 | ///
134 | public bool Button09 { get; internal set; }
135 |
136 | ///
137 | ///
138 | ///
139 | public bool Button10 { get; internal set; }
140 |
141 | ///
142 | ///
143 | ///
144 | public bool Button11 { get; internal set; }
145 |
146 | ///
147 | ///
148 | ///
149 | public bool Button12 { get; internal set; }
150 |
151 | ///
152 | ///
153 | ///
154 | public bool Button13 { get; internal set; }
155 |
156 | ///
157 | ///
158 | ///
159 | public bool Button14 { get; internal set; }
160 |
161 | ///
162 | ///
163 | ///
164 | public bool Button15 { get; internal set; }
165 |
166 | ///
167 | ///
168 | ///
169 | public bool Button16 { get; internal set; }
170 |
171 | ///
172 | ///
173 | ///
174 | public bool Button17 { get; internal set; }
175 |
176 | ///
177 | ///
178 | ///
179 | public bool Button18 { get; internal set; }
180 |
181 | ///
182 | ///
183 | ///
184 | public bool Button19 { get; internal set; }
185 |
186 | ///
187 | ///
188 | ///
189 | public bool Button20 { get; internal set; }
190 |
191 | ///
192 | ///
193 | ///
194 | public bool Button21 { get; internal set; }
195 |
196 | ///
197 | ///
198 | ///
199 | public bool Button22 { get; internal set; }
200 |
201 | ///
202 | ///
203 | ///
204 | public bool Button23 { get; internal set; }
205 |
206 | ///
207 | ///
208 | ///
209 | public bool Button24 { get; internal set; }
210 |
211 | ///
212 | ///
213 | ///
214 | public bool Button25 { get; internal set; }
215 |
216 | ///
217 | ///
218 | ///
219 | public bool Button26 { get; internal set; }
220 |
221 | ///
222 | ///
223 | ///
224 | public bool Button27 { get; internal set; }
225 |
226 | ///
227 | ///
228 | ///
229 | public bool Button28 { get; internal set; }
230 |
231 | ///
232 | ///
233 | ///
234 | public bool Button29 { get; internal set; }
235 |
236 | ///
237 | ///
238 | ///
239 | public bool Button30 { get; internal set; }
240 |
241 | ///
242 | ///
243 | ///
244 | public bool Button31 { get; internal set; }
245 |
246 | ///
247 | ///
248 | ///
249 | public bool Button32 { get; internal set; }
250 |
251 | ///
252 | ///
253 | ///
254 | public uint POV { get; internal set; }
255 |
256 | ///
257 | ///
258 | ///
259 | public double POVAngle { get; internal set; }
260 | }
261 | }
262 |
--------------------------------------------------------------------------------
/GDI/Defines/DC.cs:
--------------------------------------------------------------------------------
1 | namespace Win32
2 | {
3 | ///
4 | /// Device capabilities.
5 | ///
6 | public enum DC
7 | {
8 | ///
9 | /// Returns the of the printer driver's structure. The member
10 | /// indicates which members in the device-independent portion of the structure are supported by the printer driver.
11 | ///
12 | FIELDS=1,
13 |
14 | ///
15 | /// Retrieves a list of supported paper sizes.
16 | ///
17 | PAPERS=2,
18 |
19 | ///
20 | /// Retrieves the dimensions, in tenths of a millimeter, of each supported paper size.
21 | ///
22 | PAPERSIZE=3,
23 |
24 | ///
25 | /// Returns the minimum paper size that the and members of the printer
26 | /// driver's structure can specify.
27 | ///
28 | MINEXTENT=4,
29 |
30 | ///
31 | /// Returns the maximum paper size that the and members of the printer
32 | /// driver's structure can specify.
33 | ///
34 | MAXEXTENT=5,
35 |
36 | ///
37 | /// Retrieves a list of available paper bins.
38 | ///
39 | BINS=6,
40 |
41 | ///
42 | /// Queries if the printer supports duplex printing.
43 | ///
44 | DUPLEX=7,
45 |
46 | ///
47 | /// Returns the member of the printer driver's structure.
48 | ///
49 | SIZE=8,
50 |
51 | ///
52 | /// Returns the number of bytes required for the device-specific portion of the structure for the printer driver.
53 | ///
54 | EXTRA=9,
55 |
56 | ///
57 | /// Returns the specification version to which the printer driver conforms.
58 | ///
59 | VERSION=10,
60 |
61 | ///
62 | /// Returns the version number of the printer driver.
63 | ///
64 | DRIVER=11,
65 |
66 | ///
67 | /// Retrieves the names of the printer's paper bins.
68 | ///
69 | BINNAMES=12,
70 |
71 | ///
72 | /// Retrieves a list of the resolutions supported by the printer.
73 | ///
74 | ENUMRESOLUTIONS=13,
75 |
76 | ///
77 | /// Retrieves the names of any additional files that need to be loaded when a driver is installed.
78 | ///
79 | FILEDEPENDENCIES=14,
80 |
81 | ///
82 | /// Retrieves the abilities of the driver to use TrueType fonts.
83 | ///
84 | TRUETYPE=15,
85 |
86 | ///
87 | /// Retrieves a list of supported paper names (for example, Letter or Legal).
88 | ///
89 | PAPERNAMES=16,
90 |
91 | ///
92 | /// Returns the relationship between portrait and landscape orientations for a device, in terms of the number of degrees that portrait
93 | /// orientation is rotated counterclockwise to produce landscape orientation.
94 | ///
95 | ORIENTATION=17,
96 |
97 | ///
98 | /// Returns the number of copies the device can print.
99 | ///
100 | COPIES=18,
101 |
102 | ///
103 | /// Not used for NT-based operating systems.
104 | ///
105 | BINADJUST=19,
106 |
107 | ///
108 | /// Not used for NT-based operating systems.
109 | ///
110 | EMF_COMPLIANT=20,
111 |
112 | ///
113 | /// Not used for NT-based operating systems.
114 | ///
115 | DATATYPE_PRODUCED=21,
116 |
117 | ///
118 | /// Queries if the printer supports collating.
119 | ///
120 | COLLATE=22,
121 |
122 | ///
123 | /// Not used for NT-based operating systems.
124 | ///
125 | MANUFACTURER=23,
126 |
127 | ///
128 | /// Not used for NT-based operating systems.
129 | ///
130 | MODEL=24,
131 |
132 | ///
133 | /// Retrieves a list of printer description languages supported by the printer.
134 | ///
135 | PERSONALITY=25,
136 |
137 | ///
138 | /// The return value indicates the printer's print rate.
139 | ///
140 | PRINTRATE=26,
141 |
142 | ///
143 | /// The return value is one of the following values that indicate the print rate units () for the value returned for the flag.
144 | ///
145 | PRINTRATEUNIT=27,
146 |
147 | ///
148 | /// The return value is the amount of available printer memory, in kilobytes.
149 | ///
150 | PRINTERMEM=28,
151 |
152 | ///
153 | /// Retrieves the names of the paper forms that are currently available for use.
154 | ///
155 | MEDIAREADY=29,
156 |
157 | ///
158 | /// Queries if the printer supports stapling.
159 | ///
160 | STAPLE=30,
161 |
162 | ///
163 | /// The return value indicates the printer's print rate, in pages per minute.
164 | ///
165 | PRINTRATEPPM=31,
166 |
167 | ///
168 | /// Queries if the printer supports color printing.
169 | ///
170 | COLORDEVICE=32,
171 |
172 | ///
173 | /// Retrieves an array of integers that indicate that printer's ability to print multiple document pages per printed page.
174 | ///
175 | NUP=33,
176 |
177 | ///
178 | /// Retrieves the names of the supported media types.
179 | ///
180 | MEDIATYPENAMES=34,
181 |
182 | ///
183 | /// Retrieves a list of supported media types.
184 | ///
185 | MEDIATYPES=35,
186 | }
187 | }
188 |
--------------------------------------------------------------------------------
/Monitor/Monitor.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Runtime.InteropServices;
4 | using System.Security;
5 | using HDC=System.IntPtr;
6 | using HMONITOR=System.IntPtr;
7 |
8 | namespace Win32
9 | {
10 | ///
11 | /// Class for managing monitor devices.
12 | ///
13 | [SuppressUnmanagedCodeSecurity]
14 | public class Monitor
15 | {
16 | ///
17 | /// Handle to the display monitor.
18 | ///
19 | public readonly HMONITOR hMonitor;
20 |
21 | ///
22 | /// Handle to device context.
23 | ///
24 | public readonly HDC hdcMonitor;
25 |
26 | ///
27 | /// Rectangle with the intersection of the clipping area of the device context and the display monitor rectangle.
28 | ///
29 | public readonly Rect lprcMonitor;
30 |
31 | private Monitor() { }
32 |
33 | ///
34 | /// Initializes the class.
35 | ///
36 | /// Handle to the display monitor.
37 | /// Handle to device context.
38 | /// Rectangle with the intersection of the clipping area of the device context and the display monitor rectangle.
39 | public Monitor(HMONITOR hMonitor, HDC hdcMonitor, Rect lprcMonitor)
40 | {
41 | this.hMonitor=hMonitor;
42 | this.hdcMonitor=hdcMonitor;
43 | this.lprcMonitor=lprcMonitor;
44 | }
45 |
46 | #region Static Stuff
47 | const string DLLName="User32.dll";
48 | const string GetMonitorInfoW="GetMonitorInfoW";
49 |
50 | delegate bool MONITORENUMPROC(HMONITOR hMonitor, HDC hdcMonitor, ref Rect lprcMonitor, IntPtr dwData);
51 |
52 | [DllImport(DLLName)]
53 | static extern bool EnumDisplayMonitors(HDC hdc, [In] ref Rect lprcClip, MONITORENUMPROC lpfnEnum, IntPtr dwData);
54 |
55 | [DllImport(DLLName)]
56 | static extern bool EnumDisplayMonitors(HDC hdc, IntPtr lpNULL, MONITORENUMPROC lpfnEnum, IntPtr dwData);
57 |
58 | ///
59 | /// Retrieves information about a display monitor.
60 | ///
61 | /// The handle to the display monitor of interest.
62 | /// Structure of type to receive the requested informations.
63 | /// must be initialized with the size of .
64 | /// true if the function succeeds, otherwise false.
65 | [DllImport(DLLName, EntryPoint=GetMonitorInfoW, CharSet=CharSet.Unicode, ExactSpelling=true)]
66 | public static extern bool GetMonitorInfo(HMONITOR hMonitor, ref MonitorInfo lpmi);
67 |
68 | ///
69 | /// Retrieves information about a display monitor.
70 | ///
71 | /// The handle to the display monitor of interest.
72 | /// Structure of type to receive the requested informations. must be initialized with the size of .
73 | /// true if the function succeeds, otherwise false.
74 | [DllImport(DLLName, EntryPoint=GetMonitorInfoW, CharSet=CharSet.Unicode, ExactSpelling=true)]
75 | public static extern bool GetMonitorInfo(HMONITOR hMonitor, ref MonitorInfoEx lpmiex);
76 |
77 | static bool MonitorEnumProc(HMONITOR hMonitor, HDC hdcMonitor, ref Rect lprcMonitor, IntPtr dwData)
78 | {
79 | List monitors=(List)GCHandle.FromIntPtr(dwData).Target;
80 | monitors.Add(new Monitor(hMonitor, hdcMonitor, lprcMonitor));
81 |
82 | //MonitorInfo mi=new MonitorInfo();
83 | //mi.cbSize=(uint)Marshal.SizeOf(mi);
84 | //GetMonitorInfo(hMonitor, ref mi);
85 |
86 | return true;
87 | }
88 |
89 | ///
90 | /// Returns a list of all monitors (including invisible pseudo-monitors).
91 | ///
92 | /// A list of all monitors.
93 | public static List GetDisplayMonitors() { return GetDisplayMonitors(HDC.Zero); }
94 |
95 | ///
96 | /// Returns a list of all monitors (including invisible pseudo-monitors).
97 | ///
98 | /// The handle to a display device context that defines the visible region of interest.
99 | /// A list of all monitors.
100 | public static List GetDisplayMonitors(HDC hdc)
101 | {
102 | List monitors=new List();
103 |
104 | GCHandle data=GCHandle.Alloc(monitors);
105 | try
106 | {
107 | EnumDisplayMonitors(hdc, IntPtr.Zero, MonitorEnumProc, GCHandle.ToIntPtr(data));
108 | }
109 | finally
110 | {
111 | data.Free();
112 | }
113 |
114 | return monitors;
115 | }
116 |
117 | ///
118 | /// Returns a list of all monitors (including invisible pseudo-monitors).
119 | ///
120 | /// The region of interest as rectangle in virtual-screen coordinates.
121 | /// A list of all monitors.
122 | public static List GetDisplayMonitors(Rect rect) { return GetDisplayMonitors(HDC.Zero, rect); }
123 |
124 | ///
125 | /// Returns a list of all monitors (including invisible pseudo-monitors).
126 | ///
127 | /// The handle to a display device context that defines the visible region of interest.
128 | /// The region of interest as rectangle in virtual-screen coordinates if is null, otherwise in coordinates relative the the device context.
129 | /// A list of all monitors.
130 | public static List GetDisplayMonitors(HDC hdc, Rect rect)
131 | {
132 | List monitors=new List();
133 |
134 | GCHandle data=GCHandle.Alloc(monitors);
135 | try
136 | {
137 | EnumDisplayMonitors(hdc, ref rect, MonitorEnumProc, GCHandle.ToIntPtr(data));
138 | }
139 | finally
140 | {
141 | data.Free();
142 | }
143 |
144 | return monitors;
145 | }
146 | #endregion
147 | }
148 | }
149 |
--------------------------------------------------------------------------------
/GDI/Defines/DM.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Win32
4 | {
5 | ///
6 | /// Specifies which members of the structure have been initialized.
7 | ///
8 | [Flags]
9 | public enum DM : uint
10 | {
11 | ///
12 | ///
13 | ///
14 | ORIENTATION=0x00000001,
15 |
16 | ///
17 | ///
18 | ///
19 | PAPERSIZE=0x00000002,
20 |
21 | ///
22 | ///
23 | ///
24 | PAPERLENGTH=0x00000004,
25 |
26 | ///
27 | ///
28 | ///
29 | PAPERWIDTH=0x00000008,
30 |
31 | ///
32 | ///
33 | ///
34 | SCALE=0x00000010,
35 |
36 | ///
37 | ///
38 | ///
39 | POSITION=0x00000020,
40 |
41 | ///
42 | ///
43 | ///
44 | NUP=0x00000040,
45 |
46 | ///
47 | ///
48 | ///
49 | DISPLAYORIENTATION=0x00000080,
50 |
51 | ///
52 | ///
53 | ///
54 | COPIES=0x00000100,
55 |
56 | ///
57 | ///
58 | ///
59 | DEFAULTSOURCE=0x00000200,
60 |
61 | ///
62 | ///
63 | ///
64 | PRINTQUALITY=0x00000400,
65 |
66 | ///
67 | ///
68 | ///
69 | COLOR=0x00000800,
70 |
71 | ///
72 | ///
73 | ///
74 | DUPLEX=0x00001000,
75 |
76 | ///
77 | ///
78 | ///
79 | YRESOLUTION=0x00002000,
80 |
81 | ///
82 | ///
83 | ///
84 | TTOPTION=0x00004000,
85 |
86 | ///
87 | ///
88 | ///
89 | COLLATE=0x00008000,
90 |
91 | ///
92 | ///
93 | ///
94 | FORMNAME=0x00010000,
95 |
96 | ///
97 | ///
98 | ///
99 | LOGPIXELS=0x00020000,
100 |
101 | ///
102 | ///
103 | ///
104 | BITSPERPEL=0x00040000,
105 |
106 | ///
107 | ///
108 | ///
109 | PELSWIDTH=0x00080000,
110 |
111 | ///
112 | ///
113 | ///
114 | PELSHEIGHT=0x00100000,
115 |
116 | ///
117 | ///
118 | ///
119 | DISPLAYFLAGS=0x00200000,
120 |
121 | ///
122 | ///
123 | ///
124 | DISPLAYFREQUENCY=0x00400000,
125 |
126 | ///
127 | ///
128 | ///
129 | ICMMETHOD=0x00800000,
130 |
131 | ///
132 | ///
133 | ///
134 | ICMINTENT=0x01000000,
135 |
136 | ///
137 | ///
138 | ///
139 | MEDIATYPE=0x02000000,
140 |
141 | ///
142 | ///
143 | ///
144 | DITHERTYPE=0x04000000,
145 |
146 | ///
147 | ///
148 | ///
149 | PANNINGWIDTH=0x08000000,
150 |
151 | ///
152 | ///
153 | ///
154 | PANNINGHEIGHT=0x10000000,
155 |
156 | ///
157 | ///
158 | ///
159 | DISPLAYFIXEDOUTPUT=0x20000000,
160 |
161 | ///
162 | /// Not used.
163 | ///
164 | UPDATE=1,
165 |
166 | ///
167 | /// The function writes the printer driver's current print settings, including private data, to the data
168 | /// structure supplied by the caller. The caller must allocate a buffer sufficiently large to contain the information.
169 | /// This value is also defined as .
170 | ///
171 | COPY=2,
172 |
173 | ///
174 | /// The function presents the printer driver's Print Setup property sheet and then changes the settings in the printer's
175 | /// data structure to those values specified by the user. This value is also defined as .
176 | ///
177 | PROMPT=4,
178 |
179 | ///
180 | /// The caller has supplied a structure, the function update its internal
181 | /// structure to reflect the contents of the supplied .
182 | /// This value is also defined as .
183 | ///
184 | MODIFY=8,
185 |
186 | ///
187 | /// The caller has supplied a structure, the function update its internal
188 | /// structure to reflect the contents of the supplied .
189 | /// This value is also defined as .
190 | ///
191 | IN_BUFFER=MODIFY,
192 |
193 | ///
194 | /// The function presents the printer driver's Print Setup property sheet and then changes the settings in the printer's
195 | /// data structure to those values specified by the user. This value is also defined as .
196 | ///
197 | IN_PROMPT=PROMPT,
198 |
199 | ///
200 | /// The function writes the printer driver's current print settings, including private data, to the data
201 | /// structure supplied by the caller. The caller must allocate a buffer sufficiently large to contain the information.
202 | /// This value is also defined as .
203 | ///
204 | OUT_BUFFER=COPY,
205 |
206 | ///
207 | /// Not used.
208 | ///
209 | OUT_DEFAULT=UPDATE,
210 | }
211 | }
212 |
--------------------------------------------------------------------------------
/GDI/Structs/PixelFormatDescriptor.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.InteropServices;
3 |
4 | namespace Win32
5 | {
6 | ///
7 | /// Describes the pixel format of a drawing surface.
8 | ///
9 | [StructLayout(LayoutKind.Sequential)]
10 | public struct PixelFormatDescriptor
11 | {
12 | ///
13 | /// Specifies the size of this data structure. This value should be set to Marshal.Sizeof(new PixelFormatDescriptor()).
14 | ///
15 | public ushort nSize;
16 |
17 | ///
18 | /// Specifies the version of this data structure. This value should be set to 1.
19 | ///
20 | public ushort nVersion;
21 |
22 | ///
23 | /// Specifies the pixel format flags. See for more informations.
24 | ///
25 | public PFD dwFlags;
26 |
27 | ///
28 | /// Specifies the pixel type. See for more informations.
29 | ///
30 | public PFD_TYPE iPixelType;
31 |
32 | ///
33 | /// Specifies the number of color bitplanes in each color buffer. For RGBA pixel types, it is
34 | /// the size of the color buffer, excluding the alpha bitplanes. For color-index pixels, it is
35 | /// the size of the color-index buffer.
36 | ///
37 | public byte cColorBits;
38 |
39 | ///
40 | /// Specifies the number of red bitplanes in each RGBA color buffer.
41 | ///
42 | public byte cRedBits;
43 |
44 | ///
45 | /// Specifies the shift count for red bitplanes in each RGBA color buffer.
46 | ///
47 | public byte cRedShift;
48 |
49 | ///
50 | /// Specifies the number of green bitplanes in each RGBA color buffer.
51 | ///
52 | public byte cGreenBits;
53 |
54 | ///
55 | /// Specifies the shift count for green bitplanes in each RGBA color buffer.
56 | ///
57 | public byte cGreenShift;
58 |
59 | ///
60 | /// Specifies the number of blue bitplanes in each RGBA color buffer.
61 | ///
62 | public byte cBlueBits;
63 |
64 | ///
65 | /// Specifies the shift count for blue bitplanes in each RGBA color buffer.
66 | ///
67 | public byte cBlueShift;
68 |
69 | ///
70 | /// Specifies the number of alpha bitplanes in each RGBA color buffer. Alpha bitplanes are not supported.
71 | ///
72 | public byte cAlphaBits;
73 |
74 | ///
75 | /// Specifies the shift count for alpha bitplanes in each RGBA color buffer. Alpha bitplanes are not supported.
76 | ///
77 | public byte cAlphaShift;
78 |
79 | ///
80 | /// Specifies the total number of bitplanes in the accumulation buffer.
81 | ///
82 | [Obsolete("Accumulation buffers aren't supported in the OpenGL core profile anymore.")]
83 | public byte cAccumBits;
84 |
85 | ///
86 | /// Specifies the number of red bitplanes in the accumulation buffer.
87 | ///
88 | [Obsolete("Accumulation buffers aren't supported in the OpenGL core profile anymore.")]
89 | public byte cAccumRedBits;
90 |
91 | ///
92 | /// Specifies the number of green bitplanes in the accumulation buffer.
93 | ///
94 | [Obsolete("Accumulation buffers aren't supported in the OpenGL core profile anymore.")]
95 | public byte cAccumGreenBits;
96 |
97 | ///
98 | /// Specifies the number of blue bitplanes in the accumulation buffer.
99 | ///
100 | [Obsolete("Accumulation buffers aren't supported in the OpenGL core profile anymore.")]
101 | public byte cAccumBlueBits;
102 |
103 | ///
104 | /// Specifies the number of alpha bitplanes in the accumulation buffer.
105 | ///
106 | [Obsolete("Accumulation buffers aren't supported in the OpenGL core profile anymore.")]
107 | public byte cAccumAlphaBits;
108 |
109 | ///
110 | /// Specifies the depth of the depth (z-axis) buffer.
111 | ///
112 | public byte cDepthBits;
113 |
114 | ///
115 | /// Specifies the depth of the stencil buffer.
116 | ///
117 | public byte cStencilBits;
118 |
119 | ///
120 | /// Specifies the number of auxiliary buffers. Auxiliary buffers are not supported.
121 | ///
122 | public byte cAuxBuffers;
123 |
124 | ///
125 | /// Ignored. Earlier implementations of OpenGL used this member, but it is no longer used.
126 | ///
127 | public byte iLayerType;
128 |
129 | ///
130 | /// Specifies the number of overlay and underlay planes. Bits 0 through 3 specify up to
131 | /// 15 overlay planes and bits 4 through 7 specify up to 15 underlay planes.
132 | ///
133 | public byte bReserved;
134 |
135 | ///
136 | /// Ignored. Earlier implementations of OpenGL used this member, but it is no longer used.
137 | ///
138 | public uint dwLayerMask;
139 |
140 | ///
141 | /// Specifies the transparent color or index of an underlay plane. When the pixel type is
142 | /// RGBA, dwVisibleMask is a transparent RGB color value. When the pixel type is color
143 | /// index, it is a transparent index value.
144 | ///
145 | public uint dwVisibleMask;
146 |
147 | ///
148 | /// Ignored. Earlier implementations of OpenGL used this member, but it is no longer used.
149 | ///
150 | public uint dwDamageMask;
151 |
152 | ///
153 | /// Initializes the structure.
154 | ///
155 | /// A -bitmask specifying pixel format flags.
156 | public PixelFormatDescriptor(PFD flags=PFD.Default)
157 | {
158 | nSize=0;
159 | nVersion=1;
160 | dwFlags=flags;
161 | iPixelType=PFD_TYPE.RGBA;
162 | cColorBits=32;
163 | cRedBits=cRedShift=cGreenBits=cGreenShift=cBlueBits=cBlueShift=cAlphaBits=cAlphaShift=0;
164 | #pragma warning disable 618 // Disable deprecated messages
165 | cAccumBits=cAccumRedBits=cAccumGreenBits=cAccumBlueBits=cAccumAlphaBits=0;
166 | #pragma warning restore 618
167 | cDepthBits=24;
168 | cStencilBits=8;
169 | cAuxBuffers=iLayerType=bReserved=0;
170 | dwLayerMask=dwVisibleMask=dwDamageMask=0;
171 |
172 | nSize=(ushort)Marshal.SizeOf(this);
173 | }
174 | }
175 | }
176 |
--------------------------------------------------------------------------------
/IO/HumanInterfaceDevices/Defines/HID_USAGE_SIMULATION.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Win32.IO.HumanInterfaceDevices
4 | {
5 | ///
6 | /// Defines the usage of "Human Interface Devices" on Usage Page 2 (Simulation Controls)
7 | ///
8 | [CLSCompliant(false)]
9 | public static class HID_USAGE_SIMULATION
10 | {
11 | ///
12 | /// Undefined
13 | ///
14 | public const ushort UNDEFINED=0x00;
15 |
16 | ///
17 | /// Flight Simulation Device
18 | ///
19 | public const ushort FLIGHT=0x01;
20 |
21 | ///
22 | /// Automobile Simulation Device
23 | ///
24 | public const ushort AUTOMOBILE=0x02;
25 |
26 | ///
27 | /// Tank Simulation Device
28 | ///
29 | public const ushort TANK=0x03;
30 |
31 | ///
32 | /// Spaceship Simulation Device
33 | ///
34 | public const ushort SPACESHIP=0x04;
35 |
36 | ///
37 | /// Submarine Simulation Device
38 | ///
39 | public const ushort SUBMARINE=0x05;
40 |
41 | ///
42 | /// Sailing Simulation Device
43 | ///
44 | public const ushort SAILING=0x06;
45 |
46 | ///
47 | /// Motorcycle Simulation Device
48 | ///
49 | public const ushort MOTORCYCLE=0x07;
50 |
51 | ///
52 | /// Sports Simulation Device
53 | ///
54 | public const ushort SPORTS=0x08;
55 |
56 | ///
57 | /// Airplane Simulation Device
58 | ///
59 | public const ushort AIRPLANE=0x09;
60 |
61 | ///
62 | /// Helicopter Simulation Device
63 | ///
64 | public const ushort HELICOPTER=0x0A;
65 |
66 | ///
67 | /// Magic Carpet Simulation Device
68 | ///
69 | public const ushort MAGIC_CARPET=0x0B;
70 |
71 | ///
72 | /// Bicycle
73 | ///
74 | public const ushort BICYCLE=0x0C;
75 |
76 | //public const ushort reserved=0x0d;
77 | //...
78 | //public const ushort reserved=0x1f;
79 |
80 | ///
81 | /// Flight Control Stick
82 | ///
83 | public const ushort FLIGHT_CONTROL_STICK=0x20;
84 |
85 | ///
86 | /// Flight Stick
87 | ///
88 | public const ushort FLIGHT_STICK=0x21;
89 |
90 | ///
91 | /// Cyclic Control
92 | ///
93 | public const ushort CYCLIC_CONTROL=0x22;
94 |
95 | ///
96 | /// Cyclic Trim
97 | ///
98 | public const ushort CYCLIC_TRIM=0x23;
99 |
100 | ///
101 | /// Flight Yoke
102 | ///
103 | public const ushort FLIGHT_YOKE=0x24;
104 |
105 | ///
106 | /// Track Control
107 | ///
108 | public const ushort TRACK_CONTROL=0x25;
109 |
110 | /////
111 | ///// Driving Control
112 | /////
113 | //public const ushort DRIVING_CONTROL=0x26;
114 |
115 | //public const ushort reserved=0x26;
116 | //...
117 | //public const ushort reserved=0xaf;
118 |
119 | ///
120 | /// Aileron
121 | ///
122 | public const ushort AILERON=0xB0;
123 |
124 | ///
125 | /// Aileron Trim
126 | ///
127 | public const ushort AILERON_TRIM=0xB1;
128 |
129 | ///
130 | /// Anti-Torque Control
131 | ///
132 | public const ushort ANTI_TORQUE_CONTROL=0xB2;
133 |
134 | ///
135 | /// Autopilot Enable
136 | ///
137 | public const ushort AUTOPILOT_ENABLE=0xB3;
138 |
139 | ///
140 | /// Chaff Release
141 | ///
142 | public const ushort CHAFF_RELEASE=0xB4;
143 |
144 | ///
145 | /// Collective Control
146 | ///
147 | public const ushort COLLECTIVE_CONTROL=0xB5;
148 |
149 | ///
150 | /// Dive Brake
151 | ///
152 | public const ushort DIVE_BRAKE=0xB6;
153 |
154 | ///
155 | /// Electronic Counter Measures
156 | ///
157 | public const ushort ELECTRONIC_COUNTER_MEASURES=0xB7;
158 |
159 | ///
160 | /// Elevator
161 | ///
162 | public const ushort ELEVATOR=0xB8;
163 |
164 | ///
165 | /// Elevator Trim
166 | ///
167 | public const ushort ELEVATOR_TRIM=0xB9;
168 |
169 | ///
170 | /// Rudder
171 | ///
172 | public const ushort RUDDER=0xBA;
173 |
174 | ///
175 | /// Throttle
176 | ///
177 | public const ushort THROTTLE=0xBB;
178 |
179 | ///
180 | /// Flight Communication
181 | ///
182 | public const ushort FLIGHT_COMMUNICATION=0xBC;
183 |
184 | ///
185 | /// Flare Release
186 | ///
187 | public const ushort FLARE_RELEASE=0xBD;
188 |
189 | ///
190 | /// Landing Gear
191 | ///
192 | public const ushort LANDING_GEAR=0xBE;
193 |
194 | ///
195 | /// Toe Brake
196 | ///
197 | public const ushort TOE_BRAKE=0xBF;
198 |
199 | ///
200 | /// Trigger
201 | ///
202 | public const ushort TRIGGER=0xC0;
203 |
204 | ///
205 | /// Weapons Arm
206 | ///
207 | public const ushort WEAPONS_ARM=0xC1;
208 |
209 | ///
210 | /// Weapons Select
211 | ///
212 | public const ushort WEAPONS_SELECT=0xC2;
213 |
214 | ///
215 | /// Wing Flaps
216 | ///
217 | public const ushort WING_FLAPS=0xC3;
218 |
219 | ///
220 | /// Accelerator
221 | ///
222 | public const ushort ACCELERATOR=0xC4;
223 |
224 | ///
225 | /// Brake
226 | ///
227 | public const ushort BRAKE=0xC5;
228 |
229 | ///
230 | /// Clutch
231 | ///
232 | public const ushort CLUTCH=0xC6;
233 |
234 | ///
235 | /// Shifter
236 | ///
237 | public const ushort SHIFTER=0xC7;
238 |
239 | ///
240 | /// Steering
241 | ///
242 | public const ushort STEERING=0xC8;
243 |
244 | ///
245 | /// Turret Direction
246 | ///
247 | public const ushort TURRET_DIRECTION=0xC9;
248 |
249 | ///
250 | /// Barrel Elevation
251 | ///
252 | public const ushort BARREL_ELEVATION=0xCA;
253 |
254 | ///
255 | /// Dive Plane
256 | ///
257 | public const ushort DIVE_PLANE=0xCB;
258 |
259 | ///
260 | /// Ballast
261 | ///
262 | public const ushort BALLAST=0xCC;
263 |
264 | ///
265 | /// Bicycle Crank
266 | ///
267 | public const ushort BICYCLE_CRANK=0xCD;
268 |
269 | ///
270 | /// Handle Bars
271 | ///
272 | public const ushort HANDLE_BARS=0xCE;
273 |
274 | ///
275 | /// Front Brake
276 | ///
277 | public const ushort FRONT_BRAKE=0xCF;
278 |
279 | ///
280 | /// Rear Brake
281 | ///
282 | public const ushort REAR_BRAKE=0xD0;
283 |
284 | //public const ushort reserved=0xd1;
285 | //...
286 | //public const ushort reserved=0xffff;
287 | }
288 | }
289 |
--------------------------------------------------------------------------------