Click here to Skip to main content
15,884,042 members
Articles / Desktop Programming / Windows Forms

Storm - the world's best IDE framework for .NET

Rate me:
Please Sign up or sign in to vote.
4.96/5 (82 votes)
4 Feb 2010LGPL311 min read 274.2K   6.5K   340  
Create fast, flexible, and extensible IDE applications easily with Storm - it takes nearly no code at all!
using System;
using System.Collections;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Runtime;
using System.Runtime.InteropServices;
using System.Text;
using System.Windows.Forms;

namespace Storm.Win32
{
    /// <summary>
    /// Class containing native Win32 functions.
    /// </summary>
    public static class Win32
    {
        #region Structs
        [StructLayout(LayoutKind.Sequential)]
        public struct LOGBRUSH
        {
            #region Fields
            public uint lbStyle;
            public uint lbColor;
            public uint lbHatch;
            #endregion
        }

        [StructLayout(LayoutKind.Sequential)]
        public struct PAINTSTRUCT
        {
            #region Fields
            public int fErase;
            public int fRestore;
            public int fIncUpdate;

            public int Reserved1;
            public int Reserved2;
            public int Reserved3;
            public int Reserved4;
            public int Reserved5;
            public int Reserved6;
            public int Reserved7;
            public int Reserved8;

            public IntPtr hdc;
            public Rectangle rcPaint;
            #endregion
        }

        [StructLayout(LayoutKind.Sequential)]
        public struct POINT
        {
            #region Fields
            public int X;
            public int Y;
            #endregion

            /// <summary>
            /// Initializes the POINT.
            /// </summary>
            public POINT(int x, int y)
            {
                X = x;
                Y = y;
            }
        }

        [StructLayout(LayoutKind.Sequential)]
        public struct RECT
        {
            #region Fields
            public int Left;
            public int Top;
            public int Right;
            public int Bottom;
            #endregion

            #region Properties
            public int Width
            { get { return Right - Left; } }

            public int Height
            { get { return Bottom - Top; } }
            #endregion

            /// <summary>
            /// Initializes the RECT.
            /// </summary>
            public RECT(int left, int top, int right, int bottom)
            {
                Left = left;
                Top = top;
                Right = right;
                Bottom = bottom;
            }
        }

        [StructLayout(LayoutKind.Sequential)]
        public struct SIZE
        {
            #region Fields
            public int cx;
            public int cy;
            #endregion
        }

        [StructLayout(LayoutKind.Sequential)]
        public struct TRACKMOUSEEVENTS
        {
            #region Fields
            public uint cbSize;
            public uint dwFlags;
            public uint dwHoverTime;

            public IntPtr IntPtr;
            #endregion
        }

        [StructLayout(LayoutKind.Sequential)]
        public struct MSG
        {
            #region Fields
            public int message;
            public int time;
            public int pt_x;
            public int pt_y;

            public IntPtr IntPtr;
            public IntPtr wParam;
            public IntPtr lParam;
            #endregion
        }

        [StructLayout(LayoutKind.Sequential)]
        public struct WINDOWPOS
        {
            #region Fields
            public int x;
            public int y;
            public int cx;
            public int cy;

            public uint flags;

            public IntPtr IntPtr;
            public IntPtr IntPtrInsertAfter;
            #endregion
        }

        [StructLayout(LayoutKind.Sequential)]
        public struct _NCCALCSIZE_PARAMS
        {
            #region Fields
            public RECT NewRect;
            public RECT OldRect;
            public RECT OldClientRect;

            public WINDOWPOS lppos;
            #endregion
        }

        [StructLayout(LayoutKind.Sequential)]
        public struct MyStruct
        {
            #region Fields
            public int SomeValue;

            public byte b1;
            public byte b2;
            public byte b3;
            public byte b4;
            public byte b5;
            public byte b6;
            public byte b7;
            public byte b8;
            #endregion
        }

        [StructLayout(LayoutKind.Sequential, Pack = 1)]
        public struct BLENDFUNCTION
        {
            #region Fields
            public byte BlendOp;
            public byte BlendFlags;
            public byte SourceConstantAlpha;
            public byte AlphaFormat;
            #endregion
        }

        [StructLayout(LayoutKind.Sequential)]
        public struct GDITextMetric
        {
            #region Fields
            public int tmMemoryHeight;
            public int tmAscent;
            public int tmDescent;
            public int tmInternalLeading;
            public int tmExternalLeading;
            public int tmAveCharWidth;
            public int tmMaxCharWidth;
            public int tmWeight;
            public int tmOverhang;
            public int tmDigitizedAspectX;
            public int tmDigitizedAspectY;

            public byte tmFirstChar;
            public byte tmLastChar;
            public byte tmDefaultChar;
            public byte tmBreakChar;
            public byte tmItalic;
            public byte tmUnderlined;
            public byte tmStruckOut;
            public byte tmPitchAndFamily;
            public byte tmCharSet;
            #endregion
        }

        [StructLayout(LayoutKind.Sequential)]
        public class LogFont
        {
            #region Fields
            public int lfHeight = 0;
            public int lfWidth = 0;
            public int lfEscapement = 0;
            public int lfOrientation = 0;
            public int lfWeight = 0;

            public byte lfItalic = 0;
            public byte lfUnderline = 0;
            public byte lfStrikeOut = 0;
            public byte lfCharSet = 0;
            public byte lfOutPrecision = 0;
            public byte lfClipPrecision = 0;
            public byte lfQuality = 0;
            public byte lfPitchAndFamily = 0;

            [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)]
            public string lfFaceName = "";
            #endregion
        }

        [StructLayout(LayoutKind.Sequential)]
        public class ENUMLOGFONTEX
        {
            #region Fields
            public LogFont elfLogFont = null;

            [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 64)]
            public string elfFullName = "";

            [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)]
            public byte[] elfStyle = null;

            [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)]
            public byte[] elfScript = null;
            #endregion
        }

        [StructLayout(LayoutKind.Sequential)]
        public class COMPOSITIONFORM
        {
            #region Fields
            public int dwStyle = 0;
            public POINT ptCurrentPos = new POINT();
            public RECT rcArea = new RECT();
            #endregion
        }

        [StructLayout(LayoutKind.Sequential)]
        public struct SYSTEM_INFO
        {
            #region Fields
            public uint dwOemId;
            public uint dwPageSize;
            public uint lpMinimumApplicationAddress;
            public uint lpMaximumApplicationAddress;
            public uint dwActiveProcessorMask;
            public uint dwNumberOfProcessors;
            public uint dwProcessorType;
            public uint dwAllocationGranularity;
            public uint dwProcessorLevel;
            public uint dwProcessorRevision;
            #endregion
        }

        [StructLayout(LayoutKind.Sequential)]
        public struct MEMORYSTATUS
        {
            #region Fields
            public uint dwLength;
            public uint dwMemoryLoad;
            public uint dwTotalPhys;
            public uint dwAvailPhys;
            public uint dwTotalPageFile;
            public uint dwAvailPageFile;
            public uint dwTotalVirtual;
            public uint dwAvailVirtual;
            #endregion
        }

        public struct FILETIME
        {
            #region Fields
            public int dwLowDateTime;
            public int dwHighDateTime;
            #endregion
        }

        public struct SYSTEMTIME
        {
            #region Fields
            public short wYear;
            public short wMonth;
            public short wDayOfWeek;
            public short wDay;
            public short wHour;
            public short wMinute;
            public short wSecond;
            public short wMilliseconds;
            #endregion
        }

        public struct DRAGINFO
        {
            #region Fields
            public int uSize;
            public int fNC;
            public int grfKeyState;

            public string lpFileList;
            public POINT pt;
            #endregion
        }

        public struct APPBARDATA
        {
            #region Fields
            public int cbSize;
            public int uCallbackMessage;
            public int uEdge;
            public int lParam;

            public IntPtr IntPtr;
            public RECT rc;
            #endregion
        }

        public struct SHFILEOPSTRUCT
        {
            #region Fields
            public int wFunc;
            public int fAnyOperationsAborted;
            public short fFlags;

            public string lpszProgressTitle;
            public string pFrom;
            public string pTo;

            public IntPtr IntPtr;
            public IntPtr hNameMappings;
            #endregion
        }

        public struct SHNAMEMAPPING
        {
            #region Fields
            public int cchOldPath;
            public int cchNewPath;

            public string pszOldPath;
            public string pszNewPath;
            #endregion
        }

        public struct SHELLEXECUTEINFO
        {
            #region Fields
            public int cbSize;
            public int fMask;
            public int nShow;
            public int lpIDList;
            public int dwHotKey;

            public string lpClass;
            public string lpVerb;
            public string lpFile;
            public string lpParameters;
            public string lpDirectory;

            public IntPtr IntPtr;
            public IntPtr hInstApp;
            public IntPtr hkeyClass;
            public IntPtr hIcon;
            public IntPtr hProcess;
            #endregion
        }

        public struct NOTIFYICONDATA
        {
            #region Fields
            public int cbSize;
            public int uID;
            public int uFlags;
            public int uCallbackMessage;

            [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 64)]
            public string szTip;

            public IntPtr hIcon;
            public IntPtr IntPtr;
            #endregion
        }

        public struct SHFILEINFO
        {
            #region Fields
            public int iIcon;
            public int dwAttributes;

            [MarshalAs(UnmanagedType.ByValArray, SizeConst = MAX_PATH)]
            public string szDisplayName;

            [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 80)]
            public string szTypeName;

            public IntPtr hIcon;
            #endregion
        }

        public struct BROWSEINFO
        {
            #region Fields
            public int pIDLRoot;
            public int pszDisplayName;
            public int lpszTitle;
            public int ulFlags;
            public int lpfnCallback;
            public int lParam;
            public int iImage;

            public IntPtr IntPtrOwner;
            #endregion
        }

        public struct SECURITY_ATTRIBUTES
        {
            #region Fields
            public int nLength;
            public int lpSecurityDescriptor;
            public int bInheritHandle;
            #endregion
        }

        public struct DLGTEMPLATE
        {
            #region Fields
            public int style;
            public int dwExtendedStyle;
            public short cdit;
            public short x;
            public short y;
            public short cx;
            public short cy;
            #endregion
        }

        public struct ICONINFO
        {
            #region Fields
            public int fIcon;
            public int xHotspot;
            public int yHotspot;

            public IntPtr hbmMask;
            public IntPtr hbmColor;
            #endregion
        }

        public struct DEVMODE
        {
            #region Fields
            public int dmBitsPerPel;
            public int dmPelsWidth;
            public int dmPelsHeight;
            public int dmDisplayFlags;
            public int dmDisplayFrequency;
            public int dmFields;
            public short dmSpecVersion;
            public short dmDriverVersion;
            public short dmSize;
            public short dmDriverExtra;
            public short dmOrientation;
            public short dmPaperSize;
            public short dmPaperLength;
            public short dmPaperWidth;
            public short dmScale;
            public short dmCopies;
            public short dmDefaultSource;
            public short dmPrintQuality;
            public short dmColor;
            public short dmDuplex;
            public short dmYResolution;
            public short dmTTOption;
            public short dmCollate;
            public short dmUnusedPadding;

            [MarshalAs(UnmanagedType.ByValTStr, SizeConst = CCHFORMNAME)]
            public string dmFormName;

            [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)]
            public string dmDeviceName;
            #endregion
        }

        public struct DRAWTEXTPARAMS
        {
            #region Fields
            public int cbSize;
            public int iTabLength;
            public int iLeftMargin;
            public int iRightMargin;
            public int uiLengthDrawn;
            #endregion
        }

        public struct SCROLLINFO
        {
            #region Fields
            public int cbSize;
            public int fMask;
            public int nMin;
            public int nMax;
            public int nPage;
            public int nPos;
            public int nTrackPos;
            #endregion
        }

        [StructLayout(LayoutKind.Sequential)]
        public struct SHITEMID
        {
            #region Fields
            public ushort cb;
            [MarshalAs(UnmanagedType.LPArray)]
            public byte[] abID;
            #endregion
        }

        [StructLayout(LayoutKind.Sequential)]
        public struct ITEMIDLIST
        {
            #region Fields
            public SHITEMID mkid;
            #endregion
        }
        #endregion

        #region Delegates
        public delegate int FONTENUMPROC(ENUMLOGFONTEX f,
            int lpntme, int FontType, int lParam);
        #endregion

        #region Messages
        // These aren't actually messages, they are const sizes
        // for strings' character counts.
        public const int CCHFORMNAME = 32;
        public const int MAX_PATH = 260;
        public const int NAMESIZE = 80;

        // Win32 Messages.
        public const int ABE_BOTTOM = 3;
        public const int ABE_LEFT = 0;
        public const int ABE_RIGHT = 2;
        public const int ABE_TOP = 1;

        public const int ABM_ACTIVATE = 0x6;
        public const int ABM_GETAUTOHIDEBAR = 0x7;
        public const int ABM_GETSTATE = 0x4;
        public const int ABM_GETTASKBARPOS = 0x5;
        public const int ABM_NEW = 0x0;
        public const int ABM_QUERYPOS = 0x2;
        public const int ABM_REMOVE = 0x1;
        public const int ABM_SETAUTOHIDEBAR = 0x8;
        public const int ABM_SETPOS = 0x3;
        public const int ABM_WINDOWPOSCHANGED = 0x9;

        public const int ABN_FULLSCREENAPP = 0x2;
        public const int ABN_POSCHANGED = 0x1;
        public const int ABN_STATECHANGE = 0x0;
        public const int ABN_WINDOWARRANGE = 0x3;

        public const int ABS_ALWAYSONTOP = 0x2;
        public const int ABS_AUTOHIDE = 0x1;

        public const int BI_RGB = 0;

        public const int BIF_RETURNONLYFSDIRS = 0x0001;
        public const int BIF_DONTGOBELOWDOMAIN = 0x0002;
        public const int BIF_STATUSTEXT = 0x0004;
        public const int BIF_RETURNFSANCESTORS = 0x0008;
        public const int BIF_EDITBOX = 0x0010;
        public const int BIF_VALIDATE = 0x0020;
        public const int BIF_NEWDIALOGSTYLE = 0x0040;
        public const int BIF_USENEWUI = (BIF_NEWDIALOGSTYLE | BIF_EDITBOX);
        public const int BIF_BROWSEINCLUDEURLS = 0x0080;
        public const int BIF_BROWSEFORCOMPUTER = 0x1000;
        public const int BIF_BROWSEFORPRINTER = 0x2000;
        public const int BIF_BROWSEINCLUDEFILES = 0x4000;
        public const int BIF_SHAREABLE = 0x8000;

        public const int CS_DROPSHADOW = 0x00020000;

        public const int DIB_RGB_COLORS = 0;

        public const int DT_SINGLELINE = 0x00000020;
        public const int DT_CENTER = 0x00000001;
        public const int DT_VCENTER = 0x00000004;
        public const int DT_NOPREFIX = 0x00000800;

        public const int DTT_COMPOSITED = (int)(1UL << 13);
        public const int DTT_GLOWSIZE = (int)(1UL << 11);

        public const int EIRESID = -1;

        public const int FILE_ATTRIBUTE_DIRECTORY = 0x00000010;
        public const int FILE_ATTRIBUTE_NORMAL = 0x00000080;

        public const int FO_COPY = 0x2;
        public const int FO_DELETE = 0x3;
        public const int FO_MOVE = 0x1;
        public const int FO_RENAME = 0x4;

        public const int FOF_ALLOWUNDO = 0x40;
        public const int FOF_CONFIRMMOUSE = 0x2;
        public const int FOF_FILESONLY = 0x80;
        public const int FOF_MULTIDESTFILES = 0x1;
        public const int FOF_NOCONFIRMATION = 0x10;
        public const int FOF_NOCONFIRMMKDIR = 0x200;
        public const int FOF_RENAMEONCOLLISION = 0x8;
        public const int FOF_SILENT = 0x4;
        public const int FOF_SIMPLEPROGRESS = 0x100;
        public const int FOF_WANTMAPPINGIntPtr = 0x20;

        public const int GW_OWNER = 4;

        public const int GWL_WNDPROC = (-4);
        public const int GWL_HINSTANCE = (-6);
        public const int GWL_HWNDPARENT = (-8);
        public const int GWL_STYLE = (-16);
        public const int GWL_EXSTYLE = (-20);
        public const int GWL_USERDATA = (-21);
        public const int GWL_ID = (-12);

        public const int LWA_COLORKEY = 0x00000001;
        public const int LWA_ALPHA = 0x00000002;

        public const int MF_STRING = 0x00000000;
        public const int MF_POPUP = 0x00000010;
        public const int MF_BYCOMMAND = 0x00000000;
        public const int MF_BYPOSITION = 0x00000400;
        public const int MF_SEPARATOR = 0x00000800;

        public const int NIF_ICON = 0x2;
        public const int NIF_MESSAGE = 0x1;
        public const int NIF_TIP = 0x4;

        public const int NIM_ADD = 0x0;
        public const int NIM_DELETE = 0x2;
        public const int NIM_MODIFY = 0x1;

        public const int PO_DELETE = 0x13;
        public const int PO_PORTCHANGE = 0x20;
        public const int PO_RENAME = 0x14;
        public const int PO_REN_PORT = 0x34;

        public const int PROCESSOR_INTEL_386 = 386;
        public const int PROCESSOR_INTEL_486 = 486;
        public const int PROCESSOR_INTEL_PENTIUM = 586;
        public const int PROCESSOR_MIPS_R4000 = 4000;
        public const int PROCESSOR_ALPHA_21064 = 21064;

        public const int SRCCOPY = 0x00CC0020;

        public const int SEE_MASK_CLASSKEY = 0x3;
        public const int SEE_MASK_CLASSNAME = 0x1;
        public const int SEE_MASK_CONNECTNETDRV = 0x80;
        public const int SEE_MASK_DOENVSUBST = 0x200;
        public const int SEE_MASK_FLAG_DDEWAIT = 0x100;
        public const int SEE_MASK_FLAG_NO_UI = 0x400;
        public const int SEE_MASK_HOTKEY = 0x20;
        public const int SEE_MASK_ICON = 0x10;
        public const int SEE_MASK_IDLIST = 0x4;
        public const int SEE_MASK_INVOKEIDLIST = 0xC;
        public const int SEE_MASK_NOCLOSEPROCESS = 0x40;

        public const int SE_ERR_ACCESSDENIED = 5;
        public const int SE_ERR_ASSOCINCOMPLETE = 27;
        public const int SE_ERR_DDEBUSY = 30;
        public const int SE_ERR_DDEFAIL = 29;
        public const int SE_ERR_DDETIMEOUT = 28;
        public const int SE_ERR_DLLNOTFOUND = 32;
        public const int SE_ERR_FNF = 2;
        public const int SE_ERR_NOASSOC = 31;
        public const int SE_ERR_OOM = 8;
        public const int SE_ERR_PNF = 3;
        public const int SE_ERR_SHARE = 26;

        public const int SHGFI_ATTRIBUTES = 0x800;
        public const int SHGFI_DISPLAYNAME = 0x200;
        public const int SHGFI_EXETYPE = 0x2000;
        public const int SHGFI_ICON = 0x100;
        public const int SHGFI_ICONLOCATION = 0x1000;
        public const int SHGFI_LARGEICON = 0x0;
        public const int SHGFI_LINKOVERLAY = 0x8000;
        public const int SHGFI_OPENICON = 0x2;
        public const int SHGFI_PIDL = 0x8;
        public const int SHGFI_SELECTED = 0x10000;
        public const int SHGFI_SHELLICONSIZE = 0x4;
        public const int SHGFI_SMALLICON = 0x1;
        public const int SHGFI_SYSICONINDEX = 0x4000;
        public const int SHGFI_TYPENAME = 0x400;
        public const int SHGFI_USEFILEATTRIBUTES = 0x10;
        public const int SHGFI_ATTR_SPECIFIED = 0x000020000;
        public const int SHGFI_ADDOVERLAYS = 0x000000020;
        public const int SHGFI_OVERLAYINDEX = 0x000000040;

        public const int SHGNLI_PIDL = 0x1;
        public const int SHGNLI_PREFIXNAME = 0x2;

        public const byte VK_SHIFT = 0x10;
        public const byte VK_CAPITAL = 0x14;
        public const byte VK_NUMLOCK = 0x90;

        public const int WM_CREATE = 0x0001;
        public const int WM_DESTROY = 0x0002;
        public const int WM_MOVE = 0x0003;
        public const int WM_SIZE = 0x0005;
        public const int WM_ACTIVATE = 0x0006;
        public const int WM_COMMAND = 0x0111;
        public const int WM_SYSCOMMAND = 0x0112;
        public const int WM_MENUCOMMAND = 0x0126;
        public const int WM_MENUSELECT = 0x011F;
        public const int WM_MOUSEFIRST = 0x0200;
        public const int WM_MOUSEMOVE = 0x0200;
        public const int WM_LBUTTONDOWN = 0x0201;
        public const int WM_LBUTTONUP = 0x0202;
        public const int WM_LBUTTONDBLCLK = 0x0203;
        public const int WM_RBUTTONDOWN = 0x0204;
        public const int WM_RBUTTONUP = 0x0205;
        public const int WM_RBUTTONDBLCLK = 0x0206;
        public const int WM_MBUTTONDOWN = 0x0207;
        public const int WM_MBUTTONUP = 0x0208;
        public const int WM_MBUTTONDBLCLK = 0x0209;
        public const int WM_MOUSEWHEEL = 0x020A;
        public const int WM_XBUTTONDOWN = 0x020B;
        public const int WM_XBUTTONUP = 0x020C;
        public const int WM_XBUTTONDBLCLK = 0x020D;
        public const int WM_MOUSELAST = 0x020D;
        public const int WM_KEYDOWN = 0x100;
        public const int WM_KEYUP = 0x101;
        public const int WM_SYSKEYDOWN = 0x104;
        public const int WM_SYSKEYUP = 0x105;
        public const int WH_MOUSE_LL = 14;
        public const int WH_KEYBOARD_LL = 13;
        public const int WH_MOUSE = 7;
        public const int WH_KEYBOARD = 2;
        public const int WM_NCLBUTTONUP = 0x00A2;
        public const int WM_ERASEBKGND = 0x14;
        public const int WM_NCCALCSIZE = 0x83;
        public const int WM_NCHITTEST = 0x84;
        public const int WM_NCMOUSEMOVE = 0x00A0;
        public const int WM_NCMOUSELEAVE = 0x2a2;

        public const int WS_CHILD = 0x40000000;
        public const int WS_EX_LAYERED = 0x00080000;
        #endregion

        #region user32.dll
        [DllImport("user32")]
        public static extern int CreateCaret(IntPtr IntPtr, IntPtr hBitmap, int nWidth, 
            int nHeight);

        [DllImport("user32")]
        public static extern int CreateCursor(IntPtr hInstance, int nXhotspot, 
            int nYhotspot, int nWidth, int nHeight, IntPtr lpANDbitPlane, 
            IntPtr lpXORbitPlane);

        [DllImport("user32")]
        public static extern int CreateDesktop(string lpszDesktop, string lpszDevice, 
            ref DEVMODE pDevmode, int dwFlags, int dwDesiredAccess, 
            ref SECURITY_ATTRIBUTES lpsa);

        [DllImport("user32")]
        public static extern int CreateDialogIndirectParam(IntPtr hInstance, 
            ref DLGTEMPLATE lpTemplate, IntPtr IntPtrParent, ref int lpDialogFunc, 
            int dwInitParam);

        [DllImport("user32")]
        public static extern int CreateDialogParam(IntPtr hInstance, string lpName, 
            IntPtr IntPtrParent, ref int lpDialogFunc, int lParamInit);

        [DllImport("user32")]
        public static extern int CreateIcon(IntPtr hInstance, int nWidth, int nHeight, 
            Byte nPlanes, Byte nBitsPixel, Byte lpANDbits, Byte lpXORbits);

        [DllImport("user32")]
        public static extern int CreateIconFromResource(Byte presbits, int dwResSize, 
            int fIcon, int dwVer);

        [DllImport("user32")]
        public static extern int CreateIconIndirect(ref ICONINFO piconinfo);

        [DllImport("user32")]
        public static extern int CreateMDIWindow(string lpClassName, string lpWindowName, 
            int dwStyle, int x, int y, int nWidth, int nHeight, IntPtr IntPtrParent, 
            IntPtr hInstance, int lParam);

        [DllImport("user32")]
        public static extern int CreateMenu();

        [DllImport("user32")]
        public static extern int CreatePopupMenu();

        [DllImport("user32")]
        public static extern int DestroyCaret();

        [DllImport("user32")]
        public static extern int DestroyCursor(IntPtr hCursor);

        [DllImport("user32")]
        public static extern int DestroyIcon(IntPtr hIcon);

        [DllImport("user32")]
        public static extern int DestroyMenu(IntPtr hMenu);

        [DllImport("user32")]
        public static extern int DestroyWindow(IntPtr IntPtr);

        [DllImport("user32")]
        public static extern int DrawAnimatedRects(IntPtr IntPtr, int idAni, 
            ref RECT lprcFrom, ref RECT lprcTo);

        [DllImport("user32")]
        public static extern int DrawCaption(IntPtr IntPtr, IntPtr hdc, 
            ref RECT pcRect, int un);

        [DllImport("user32")]
        public static extern int DrawEdge(IntPtr hdc, ref RECT qrc, int edge, int grfFlags);

        [DllImport("user32")]
        public static extern int DrawFocusRect(IntPtr hdc, ref RECT lpRect);

        [DllImport("user32")]
        public static extern int DrawFrameControl(IntPtr hdc, ref RECT lpRect, int un1, 
            int un2);

        [DllImport("user32")]
        public static extern int DrawIcon(IntPtr hdc, int x, int y, IntPtr hIcon);

        [DllImport("user32")]
        public static extern int DrawIconEx(IntPtr hdc, int xLeft, int yTop, IntPtr hIcon, 
            int cxWidth, int cyWidth, int istepIfAniCur, IntPtr hbrFlickerFreeDraw, 
            int diFlags);

        [DllImport("user32")]
        public static extern int DrawMenuBar(IntPtr IntPtr);

        [DllImport("user32")]
        public static extern int DrawState(IntPtr hdc, IntPtr hBrush, 
            ref int lpDrawStateProc, int lParam, int wParam, int n1, 
            int n2, int n3, int n4, int un);

        [DllImport("user32")]
        public static extern int DrawText(IntPtr hdc, string lpStr, int nCount, 
            ref RECT lpRect, int wFormat);

        [DllImport("user32")]
        public static extern int DrawTextEx(IntPtr hdc, string lpsz, int n, 
            ref RECT lpRect, int un, ref DRAWTEXTPARAMS lpDrawTextParams);

        [DllImport("user32.dll")]
        public static extern Int32 SendMessage(IntPtr pWnd,
            UInt32 uMsg, UInt32 wParam, IntPtr lParam);

        [DllImport("user32.dll", CharSet = CharSet.Auto)]
        public static extern bool AnimateWindow(IntPtr IntPtr,
            uint dwTime, uint dwFlags);

        [DllImport("user32.dll", CharSet = CharSet.Auto)]
        public static extern IntPtr BeginPaint(IntPtr IntPtr,
            ref PAINTSTRUCT ps);

        [DllImport("user32.dll", CharSet = CharSet.Auto)]
        public static extern bool ClientToScreen(IntPtr IntPtr,
            ref POINT pt);

        [DllImport("user32.dll", CharSet = CharSet.Auto)]
        public static extern bool DispatchMessage(ref MSG msg);

        [DllImport("user32.dll", CharSet = CharSet.Auto)]
        public static extern bool EndPaint(IntPtr IntPtr,
            ref PAINTSTRUCT ps);

        [DllImport("user32.dll", CharSet = CharSet.Auto)]
        public static extern IntPtr GetDC(IntPtr IntPtr);

        [DllImport("user32.dll", CharSet = CharSet.Auto)]
        public static extern IntPtr GetFocus();

        [DllImport("user32.dll", CharSet = CharSet.Auto)]
        public static extern ushort GetKeyState(int virtKey);

        [DllImport("user32.dll", CharSet = CharSet.Auto)]
        public static extern bool GetMessage(ref MSG msg,
            int IntPtr, uint wFilterMin, uint wFilterMax);

        [DllImport("user32.dll", CharSet = CharSet.Auto)]
        public static extern IntPtr GetParent(IntPtr IntPtr);

        [DllImport("user32.dll", CharSet = CharSet.Auto)]
        public static extern int GetWindowLong(IntPtr IntPtr,
                                               int nIndex);

        [DllImport("user32.dll", CharSet = CharSet.Auto)]
        public static extern bool GetWindowRect(IntPtr IntPtr,
            ref RECT rect);

        [DllImport("user32.dll", CharSet = CharSet.Auto)]
        public static extern bool HideCaret(IntPtr IntPtr);

        [DllImport("user32.dll", CharSet = CharSet.Auto)]
        public static extern bool InvalidateRect(IntPtr IntPtr,
                             ref RECT rect, bool erase);

        [DllImport("user32.dll", CharSet = CharSet.Auto)]
        public static extern IntPtr LoadCursor(IntPtr hInstance,
            uint cursor);

        [DllImport("user32")]
        public static extern int ExitWindows(int dwReserved, int uReturnCode);

        [DllImport("user32")]
        public static extern int ExitWindowsEx(int uFlags, int dwReserved);

        [DllImport("user32.dll", CharSet = CharSet.Auto)]
        public static extern bool MoveWindow(IntPtr IntPtr,
        int x, int y, int width, int height, bool repaint);

        [DllImport("user32.dll", CharSet = CharSet.Auto)]
        public static extern bool PeekMessage(ref MSG msg,
        int IntPtr, uint wFilterMin, uint wFilterMax, uint wFlag);

        [DllImport("user32.dll", CharSet = CharSet.Auto)]
        public static extern bool PostMessage(IntPtr IntPtr,
            int Msg, uint wParam, uint lParam);

        [DllImport("user32.dll", CharSet = CharSet.Auto)]
        public static extern bool ReleaseCapture();

        [DllImport("user32.dll", CharSet = CharSet.Auto)]
        public static extern int ReleaseDC(IntPtr IntPtr, IntPtr hDC);

        [DllImport("user32.dll", CharSet = CharSet.Auto)]
        public static extern bool ScreenToClient(IntPtr IntPtr,
            ref POINT pt);

        [DllImport("user32.dll", CharSet = CharSet.Auto)]
        public static extern uint SendMessage(IntPtr IntPtr,
            int Msg, uint wParam, uint lParam);

        [DllImport("user32.dll", CharSet = CharSet.Auto)]
        public static extern IntPtr SetCursor(IntPtr hCursor);

        [DllImport("user32.dll", CharSet = CharSet.Auto)]
        public static extern IntPtr SetFocus(IntPtr IntPtr);

        [DllImport("user32.dll", CharSet = CharSet.Auto)]
        public static extern int SetWindowLong(IntPtr IntPtr,
            int nIndex, int newLong);

        [DllImport("user32.dll", CharSet = CharSet.Auto)]
        public static extern int SetWindowPos(IntPtr IntPtr,
            IntPtr IntPtrAfter, int x, int y, int width,
            int height, uint flags);

        [DllImport("user32.dll", CharSet = CharSet.Auto)]
        public static extern bool SetWindowRgn(IntPtr IntPtr,
            IntPtr hRgn, bool redraw);

        [DllImport("user32.dll", CharSet = CharSet.Auto)]
        public static extern bool ShowCaret(IntPtr IntPtr);

        [DllImport("user32.dll", CharSet = CharSet.Auto)]
        public static extern int ShowWindow(IntPtr IntPtr,
            short cmdShow);

        [DllImport("user32.dll", CharSet = CharSet.Auto)]
        public static extern bool SystemParametersInfo
            (uint uiAction, uint uiParam, ref int bRetValue,
            uint fWinINI);

        [DllImport("user32.dll", CharSet = CharSet.Auto)]
        public static extern bool TrackMouseEvent
            (ref TRACKMOUSEEVENTS tme);

        [DllImport("user32")]
        public static extern int CopyCursor(IntPtr hcur);
        [DllImport("user32")]
        public static extern int CopyIcon(IntPtr hIcon);
        [DllImport("user32")]
        public static extern int CopyImage(IntPtr IntPtr, int un1, int n1, int n2, int un2);
        [DllImport("user32")]
        public static extern int CopyRect(ref RECT lpDestRect, ref RECT lpSourceRect);

        [DllImport("user32.dll", CharSet = CharSet.Auto)]
        public static extern bool TranslateMessage(ref MSG msg);

        [DllImport("user32.dll", CharSet = CharSet.Auto)]
        public static extern bool UpdateLayeredWindow
            (IntPtr IntPtr, IntPtr hdcDst, ref POINT pptDst,
            ref SIZE psize, IntPtr hdcSrc, ref POINT pprSrc,
            int crKey, ref BLENDFUNCTION pblend, int dwFlags);

        [DllImport("user32.dll", CharSet = CharSet.Auto)]
        public static extern bool UpdateWindow(IntPtr IntPtr);

        [DllImport("user32.dll", CharSet = CharSet.Auto)]
        public static extern bool WaitMessage();

        [DllImport("user32.dll")]
        public static extern int AdjustWindowRect(ref RECT lpRect, int dwStyle, 
            int bMenu);

        [DllImport("user32.dll")]
        public static extern int AdjustWindowRectEx(ref RECT lpRect, int dsStyle, 
            int bMenu, int dwEsStyle);

        [DllImport("user32.dll")]
        public static extern int BringWindowToTop(IntPtr IntPtr);

        [DllImport("user32.dll")]
        public static extern IntPtr CreateWindowEx(uint dwExStyle, string lpClassName, 
            string lpWindowName, uint dwStyle, int x, int y, int nWidth, int nHeight, 
            IntPtr IntPtrParent, IntPtr hMenu, IntPtr hInstance, IntPtr lpParam);

        [DllImport("user32.dll")]
        public static extern int FillRect(IntPtr hDC, ref RECT rect, IntPtr hBrush);

        [DllImport("user32.dll")]
        public static extern UInt16 GetAsyncKeyState(int vKey);

        [DllImport("user32.dll")]
        public static extern IntPtr GetDesktopWindow();

        [DllImport("user32.dll")]
        public static extern uint GetTabbedTextExtent(IntPtr hDC, string lpString, 
            int nCount, int nTabPositions, ref int lpnTabStopPositions);

        [DllImport("user32.dll")]
        public static extern IntPtr GetWindowDC(IntPtr IntPtr);

        [DllImport("user32.dll")]
        public static extern int InvertRect(IntPtr hDC, ref RECT rect);

        [DllImport("user32.dll")]
        public static extern int SendMessage(IntPtr IntPtr, int msg, int wParam, 
            LogFont lParam);

        [DllImport("user32.dll")]
        public static extern int SendMessage(IntPtr IntPtr, int msg, int wParam, 
            COMPOSITIONFORM lParam);

        [DllImport("user32.dll")]
        public static extern int SendMessage(IntPtr IntPtr, int message, 
            int WParam, int LParam);

        [DllImport("user32.dll")]
        public static extern int TabbedTextOut(IntPtr hDC, int x, int y, string lpString, 
            int nCount, int nTabPositions, ref int lpnTabStopPositions, int nTabOrigin);

        [DllImport("user32.dll")]
        public static extern IntPtr WindowFromDC(int hdc);

        [DllImport("user32")]
        public static extern int CloseClipboard();

        [DllImport("user32")]
        public static extern int CloseDesktop(IntPtr hDesktop);

        [DllImport("user32")]
        public static extern int CloseWindow(IntPtr IntPtr);

        [DllImport("user32")]
        public static extern int CloseWindowStation(IntPtr hWinSta);

        [DllImport("user32")]
        public static extern int EnableMenuItem(IntPtr hMenu, int wIDEnableItem, 
            int wEnable);

        [DllImport("user32")]
        public static extern int EnableScrollBar(IntPtr IntPtr, int wSBflags, int wArrows);

        [DllImport("user32")]
        public static extern int EnableWindow(IntPtr IntPtr, int fEnable);

        [DllImport("user32")]
        public static extern int FindWindow(string lpClassName, string lpWindowName);

        [DllImport("user32")]
        public static extern int FindWindowEx(IntPtr IntPtr1, IntPtr IntPtr2, string lpsz1, 
            string lpsz2);

        [DllImport("user32")]
        public static extern int FlashWindow(IntPtr IntPtr, int bInvert);

        [DllImport("user32")]
        public static extern int GetActiveWindow();

        [DllImport("user32")]
        public static extern int GetClientRect(IntPtr IntPtr, ref RECT lpRect);

        [DllImport("user32")]
        public static extern int GetClipCursor(out RECT lprc);

        [DllImport("user32")]
        public static extern int GetClipboardData(int wFormat);

        [DllImport("user32")]
        public static extern int GetClipboardFormatName(int wFormat, string lpString, 
            int nMaxCount);

        [DllImport("user32")]
        public static extern int GetClipboardOwner();

        [DllImport("user32")]
        public static extern int GetClipboardViewer();

        [DllImport("user32")]
        public static extern int GetCursor();

        [DllImport("user32")]
        public static extern int GetCursorPos(out POINT lpPoint);

        [DllImport("user32")]
        public static extern int GetCapture();

        [DllImport("user32")]
        public static extern int GetCaretBlinkTime();

        [DllImport("user32")]
        public static extern int GetCaretPos(ref POINT lpPoint);

        [DllImport("user32")]
        public static extern int GetScrollInfo(IntPtr IntPtr, int n, 
            ref SCROLLINFO lpScrollInfo);

        [DllImport("user32")]
        public static extern int GetScrollPos(IntPtr IntPtr, int nBar);

        [DllImport("user32")]
        public static extern int GetScrollRange(IntPtr IntPtr, int nBar, ref int lpMinPos, 
            ref int lpMaxPos);

        [DllImport("user32")]
        public static extern int LoadBitmap(IntPtr hInstance, string lpBitmapName);

        [DllImport("user32")]
        public static extern int LoadCursor(IntPtr hInstance, string lpCursorName);

        [DllImport("user32")]
        public static extern int LoadCursorFromFile(string lpFileName);

        [DllImport("user32")]
        public static extern int LoadIcon(IntPtr hInstance, string lpIconName);

        [DllImport("user32")]
        public static extern int LoadImage(IntPtr hInst, string lpsz, int un1, int n1, 
            int n2, int un2);

        [DllImport("user32")]
        public static extern int LoadKeyboardLayout(string pwszKLID, int flags);

        [DllImport("user32")]
        public static extern int LoadMenu(IntPtr hInstance, string lpString);

        [DllImport("user32")]
        public static extern int LoadMenuIndirect(int lpMenuTemplate);

        [DllImport("user32")]
        public static extern int LoadString(IntPtr hInstance, int wID, string lpBuffer, 
            int nBufferMax);

        [DllImport("user32")]
        public static extern int LockWindowUpdate(IntPtr IntPtrLock);

        [DllImport("user32")]
        public static extern int MessageBeep(int wType);

        [DllImport("user32")]
        public static extern int MessageBox(IntPtr IntPtr, string lpText, string lpCaption, 
            int wType);

        [DllImport("user32")]
        public static extern int MessageBoxEx(IntPtr IntPtr, string lpText, string lpCaption, 
            int uType, int wLanguageId);

        [DllImport("user32")]
        public static extern int MoveWindow(IntPtr IntPtr, int x, int y, int nWidth, 
            int nHeight, int bRepaint);

        [DllImport("user32")]
        public static extern int ScrollDC(IntPtr hdc, int dx, int dy, ref RECT lprcScroll, 
            ref RECT lprcClip, IntPtr hrgnUpdate, ref RECT lprcUpdate);

        [DllImport("user32")]
        public static extern int ScrollWindow(IntPtr IntPtr, int XAmount, int YAmount, 
            ref RECT lpRect, ref RECT lpClipRect);

        [DllImport("user32")]
        public static extern int ScrollWindowEx(IntPtr IntPtr, int dx, int dy, 
            ref RECT lprcScroll, ref RECT lprcClip, IntPtr hrgnUpdate, 
            ref RECT lprcUpdate, int fuScroll);

        [DllImport("user32")]
        public static extern int SetCursorPos(int x, int y);

        [DllImport("user32")]
        public static extern int SetActiveWindow(IntPtr IntPtr);

        [DllImport("user32")]
        public static extern int SetCapture(IntPtr IntPtr);

        [DllImport("user32")]
        public static extern int SetCaretBlinkTime(int wMSeconds);

        [DllImport("user32")]
        public static extern int SetCaretPos(int x, int y);

        [DllImport("user32")]
        public static extern int SetScrollPos(IntPtr IntPtr, int nBar, int nPos, int bRedraw);

        [DllImport("user32")]
        public static extern int ShowCursor(int bShow);

        [DllImport("user32")]
        public static extern int ShowScrollBar(IntPtr IntPtr, int wBar, int bShow);

        [DllImport("user32")]
        public static extern int ShowWindow(IntPtr IntPtr, int nCmdShow);

        [DllImport("user32")]
        public static extern int ShowWindowAsync(IntPtr IntPtr, int nCmdShow);

        [DllImport("user32")]
        public static extern void PostQuitMessage(int nExitCode);

        [DllImport("user32")]
        public static extern void mouse_event(int dwFlags, int dx, int dy, int cButtons, 
            int dwExtraInfo);

        [DllImport("user32")]
        public static extern void SetLastErrorEx(int dwErrCode, int dwType);
        #endregion

        #region gdi32.dll
        [DllImport("gdi32.dll")]
        public static extern int SetDIBits
            (IntPtr hdc, IntPtr hBitmap, int nStartScan,
            int nNumScans, IntPtr lpBits, IntPtr lpBI,
            int wUsage);

        [DllImport("gdi32.dll")]
        public static extern int SetDIBitsToDevice
            (IntPtr hdc, int x, int y, int dx, int dy,
            int SrcX, int SrcY, int Scan, int NumScans,
            IntPtr Bits, IntPtr BitsInfo, int wUsage);

        [DllImport("gdi32.dll")]
        public static extern IntPtr CreateDIBSection
            (IntPtr hdc, IntPtr pBitmapInfo, int un,
            IntPtr lplpVoid, IntPtr IntPtr, int dw);

        [DllImport("gdi32.dll", CharSet = CharSet.Auto)]
        public static extern int SetPixel(IntPtr hdc,
            int x, int y, int crColor);

        [DllImport("gdi32.dll", CharSet = CharSet.Auto)]
        public static extern int GetPixel
            (IntPtr hdc, int x, int y);

        [DllImport("gdi32.dll", CharSet = CharSet.Auto)]
        public static extern int CombineRgn(IntPtr dest,
            IntPtr src1, IntPtr src2, int flags);

        [DllImport("gdi32.dll", CharSet = CharSet.Auto)]
        public static extern IntPtr CreateBrushIndirect
            (ref LOGBRUSH brush);

        [DllImport("gdi32.dll", CharSet = CharSet.Auto)]
        public static extern IntPtr CreateRectRgnIndirect
            (ref RECT rect);

        [DllImport("gdi32.dll", CharSet = CharSet.Auto)]
        public static extern int GetClipBox(IntPtr hDC,
            ref RECT rectBox);

        [DllImport("gdi32.dll", CharSet = CharSet.Auto)]
        public static extern bool PatBlt(IntPtr hDC,
            int x, int y, int width, int height, uint flags);

        [DllImport("gdi32.dll", CharSet = CharSet.Auto)]
        public static extern int SelectClipRgn(IntPtr hDC,
            IntPtr hRgn);

        [DllImport("gdi32.dll", CharSet = CharSet.Auto,
            CallingConvention = CallingConvention.StdCall,
            SetLastError = true)]
        public static extern IntPtr MoveToEx(IntPtr hDC,
            int x, int y, ref POINT lpPoint);

        [DllImport("gdi32.dll", CharSet = CharSet.Auto,
            CallingConvention = CallingConvention.StdCall,
            SetLastError = true)]
        public static extern IntPtr LineTo(IntPtr hDC,
            int x, int y);

        [DllImport("gdi32.dll", CharSet = CharSet.Auto,
            CallingConvention = CallingConvention.StdCall,
            SetLastError = true)]
        public static extern IntPtr CreatePen(int nPenStyle,
            int nWidth, int crColor);

        [DllImport("gdi32.dll", CharSet = CharSet.Auto,
            CallingConvention = CallingConvention.StdCall,
            SetLastError = true)]
        public static extern int SetBrushOrgEx(IntPtr hDC,
            int x, int y, ref POINT p);

        [DllImport("gdi32.dll", CharSet = CharSet.Auto,
            CallingConvention = CallingConvention.StdCall,
            SetLastError = true)]
        public static extern IntPtr CreatePatternBrush
            (IntPtr hBMP);

        [DllImport("gdi32.dll", CharSet = CharSet.Auto,
            CallingConvention = CallingConvention.StdCall,
            SetLastError = true)]
        public static extern int GetTextFace(IntPtr hDC,
            int nCount, string lpFacename);

        [DllImport("gdi32.dll", CharSet = CharSet.Auto,
            CallingConvention = CallingConvention.StdCall,
            SetLastError = true)]
        public static extern int GetTextMetrics(IntPtr hDC,
            ref GDITextMetric TextMetric);

        [DllImport("gdi32.dll", CharSet = CharSet.Ansi,
            CallingConvention = CallingConvention.StdCall,
            SetLastError = true)]
        public static extern IntPtr CreateFontIndirect
        ([MarshalAs(UnmanagedType.LPStruct)]LogFont LogFont);

        [DllImport("gdi32.dll", SetLastError = true,
            CharSet = CharSet.Auto, CallingConvention =
            CallingConvention.StdCall)]
        public static extern int BitBlt(IntPtr hDestDC,
            int x, int y, int nWidth, int nHeight,
            IntPtr hSrcDC, int xSrc, int ySrc, int dwRop);

        [DllImport("gdi32.dll", CharSet = CharSet.Auto,
            CallingConvention = CallingConvention.StdCall,
            SetLastError = true)]
        public static extern IntPtr CreateSolidBrush
            (int crColor);

        [DllImport("gdi32.dll", CharSet = CharSet.Auto,
            CallingConvention = CallingConvention.StdCall,
            SetLastError = true)]
        public static extern int Rectangle(IntPtr hDC,
            int left, int top, int right, int bottom);

        [DllImport("gdi32.dll", CharSet = CharSet.Auto,
            CallingConvention = CallingConvention.StdCall,
            SetLastError = true)]
        public static extern IntPtr CreateHatchBrush
            (int Style, int crColor);


        [DllImport("gdi32.dll", CharSet = CharSet.Auto,
            CallingConvention = CallingConvention.StdCall,
            SetLastError = true)]
        public static extern IntPtr CreateCompatibleBitmap
            (IntPtr hDC, int nWidth, int nHeight);

        [DllImport("gdi32.dll", CharSet = CharSet.Auto,
            CallingConvention = CallingConvention.StdCall,
            SetLastError = true)]
        public static extern IntPtr CreateCompatibleDC
            (IntPtr hDC);

        [DllImport("gdi32.dll", CharSet = CharSet.Auto,
            CallingConvention = CallingConvention.StdCall,
            SetLastError = true)]
        public static extern IntPtr SelectObject
            (IntPtr hDC, IntPtr hObject);

        [DllImport("gdi32.dll", CharSet = CharSet.Auto,
            CallingConvention = CallingConvention.StdCall,
            SetLastError = true)]
        public static extern IntPtr DeleteObject
            (IntPtr hObject);

        [DllImport("gdi32.dll", SetLastError = true,
            CharSet = CharSet.Auto, CallingConvention =
            CallingConvention.StdCall)]
        public static extern int GetTextColor(IntPtr hDC);

        [DllImport("gdi32.dll", SetLastError = true,
            CharSet = CharSet.Auto, CallingConvention =
            CallingConvention.StdCall)]
        public static extern int SetTextColor
            (IntPtr hDC, int crColor);

        [DllImport("gdi32.dll", SetLastError = true,
            CharSet = CharSet.Auto, CallingConvention =
            CallingConvention.StdCall)]
        public static extern int GetBkColor(IntPtr hDC);

        [DllImport("gdi32.dll", SetLastError = true,
            CharSet = CharSet.Auto, CallingConvention =
            CallingConvention.StdCall)]
        public static extern int GetBkMode(IntPtr hDC);

        [DllImport("gdi32.dll", CharSet = CharSet.Auto,
            CallingConvention = CallingConvention.StdCall,
            SetLastError = true)]
        public static extern IntPtr DeleteDC(IntPtr hDC);

        [DllImport("gdi32.dll", SetLastError = true,
            CharSet = CharSet.Auto, CallingConvention =
            CallingConvention.StdCall)]
        public static extern int SetBkColor
            (IntPtr hDC, int crColor);

        [DllImport("gdi32.dll", SetLastError = true,
            CharSet = CharSet.Auto, CallingConvention =
            CallingConvention.StdCall)]
        public static extern int SetBkMode
            (IntPtr hDC, int Mode);

        [DllImport("gdi32.dll", CharSet = CharSet.Auto,
            CallingConvention = CallingConvention.StdCall,
            SetLastError = true)]
        public static extern int GdiFlush();

        [DllImport("gdi32.dll", SetLastError = true,
            CharSet = CharSet.Ansi, CallingConvention =
            CallingConvention.StdCall)]
        public static extern int EnumFontFamiliesEx
            (IntPtr hDC, [MarshalAs(UnmanagedType.LPStruct)] 
                LogFont lf, FONTENUMPROC proc, Int64 LParam,
            Int64 DW);

        [DllImport("gdi32.dll", EntryPoint = "GdiAlphaBlend")]
        public static extern bool AlphaBlend(
          IntPtr hdcDest,             // IntPtr to destination DC.
          int nXOriginDest,           // X-coord of upper-left corner.
          int nYOriginDest,           // Y-coord of upper-left corner.
          int nWidthDest,             // Destination width.
          int nHeightDest,            // Destination height.
          IntPtr hdcSrc,              // IntPtr to source DC.
          int nXOriginSrc,            // X-coord of upper-left corner.
          int nYOriginSrc,            // Y-coord of upper-left corner.
          int nWidthSrc,              // Source width.
          int nHeightSrc,             // Source height.
          BLENDFUNCTION blendFunction // Alpha-blending function.
        );
        #endregion

        #region kernel32.dll
        [DllImport("kernel32")]
        static extern void GetSystemInfo(ref SYSTEM_INFO pSI);

        [DllImport("kernel32")]
        static extern void GlobalMemoryStatus(ref MEMORYSTATUS buf);
        #endregion

        #region shell32.dll
        [DllImport("shell32")]
        public static extern int CommandLineToArgv
            (string lpCmdLine, short pNumArgs);

        [DllImport("shell32")]
        public static extern int DoEnvironmentSubst
            (string szString, int cbString);

        [DllImport("shell32")]
        public static extern int DragQueryFile
        (IntPtr hDROP, int UINT, string lpStr, int ch);

        [DllImport("shell32")]
        public static extern int DragQueryPoint
            (IntPtr hDROP, ref POINT lpPoint);

        [DllImport("shell32")]
        public static extern int DuplicateIcon
            (IntPtr hInst, IntPtr hIcon);

        [DllImport("shell32")]
        public static extern int ExtractAssociatedIcon
        (IntPtr hInst, string lpIconPath, ref int lpiIcon);

        [DllImport("shell32")]
        public static extern int ExtractIcon
        (IntPtr hInst, string lpszExeFileName, int nIconIndex);

        [DllImport("shell32")]
        public static extern int ExtractIconEx
            (string lpszFile, int nIconIndex, ref int phiconLarge,
            ref int phiconSmall, int nIcons);

        [DllImport("shell32")]
        public static extern int FindExecutable
            (string lpFile, string lpDirectory,
            string lpResult);

        [DllImport("shell32")]
        public static extern int SHAppBarMessage
        (int dwMessage, ref APPBARDATA pData);

        [DllImport("shell32")]
        public static extern int SHFileOperation
            (ref SHFILEOPSTRUCT lpFileOp);

        [DllImport("shell32")]
        public static extern int SHGetFileInfo
            (string pszPath, int dwFileAttributes,
            ref SHFILEINFO psfi, int cbFileInfo, int uFlags);

        [DllImport("shell32")]
        public static extern int SHGetNewLinkInfo
            (string pszLinkto, string pszDir, string pszName,
            ref int pfMustCopy, int uFlags);

        [DllImport("shell32")]
        public static extern int ShellAbout
            (IntPtr IntPtr, string szApp, string szOtherStuff,
            IntPtr hIcon);

        [DllImport("shell32")]
        public static extern int ShellExecute
            (IntPtr IntPtr, string lpOperation, string lpFile,
            string lpParameters, string lpDirectory,
            int nShowCmd);

        [DllImport("shell32")]
        public static extern int Shell_NotifyIcon
            (int dwMessage, ref NOTIFYICONDATA lpData);

        [DllImport("shell32")]
        public static extern void DragAcceptFiles
            (IntPtr IntPtr, int fAccept);

        [DllImport("shell32")]
        public static extern void DragFinish(IntPtr hDrop);

        [DllImport("shell32")]
        public static extern void SHFreeNameMappings
            (IntPtr hNameMappings);

        [DllImport("shell32")]
        public static extern void WinExecError
            (IntPtr IntPtr, int error, string lpstrFileName,
            string lpstrTitle);

        [DllImport("shell32")]
        public static extern int SHBrowseForFolder
            (BROWSEINFO lpbi);

        [DllImport("shell32")]
        public static extern int SHGetPathFromIDList
            (int pidList, string lpBuffer);

        [DllImport("Shell32.dll")]
        public static extern IntPtr SHGetFileInfo(
            string pszPath,
            uint dwFileAttributes,
            ref SHFILEINFO psfi,
            uint cbFileInfo,
            uint uFlags
            );
        #endregion

        #region Errors
        public static int CACHE_E_FIRST = unchecked((int)0x80040170);
        public static int CACHE_E_LAST = unchecked((int)0x8004017F);
        public static int CACHE_E_NOCACHE_UPDATED = unchecked((int)0x80040170);
        public static int CACHE_S_FIRST = 0x40170;
        public static int CACHE_S_FORMATETC_NOTSUPPORTED = 0x40170;
        public static int CACHE_S_LAST = 0x4017F;
        public static int CACHE_S_SAMECACHE = 0x40171;
        public static int CACHE_S_SOMECACHES_NOTUPDATED = 0x40172;
        public static int CLASSFACTORY_E_FIRST = unchecked((int)0x80040110);
        public static int CLASSFACTORY_E_LAST = unchecked((int)0x8004011F);
        public static int CLASSFACTORY_S_FIRST = 0x40110;
        public static int CLASSFACTORY_S_LAST = 0x4011F;
        public static int CLASS_E_CLASSNOTAVAILABLE = unchecked((int)0x80040111);
        public static int CLASS_E_NOAGGREGATION = unchecked((int)0x80040110);
        public static int CLIENTSITE_E_FIRST = unchecked((int)0x80040190);
        public static int CLIENTSITE_E_LAST = unchecked((int)0x8004019F);
        public static int CLIENTSITE_S_FIRST = 0x40190;
        public static int CLIENTSITE_S_LAST = 0x4019F;
        public static int CLIPBRD_E_BAD_DATA = unchecked((int)0x800401D3);
        public static int CLIPBRD_E_CANT_CLOSE = unchecked((int)0x800401D4);
        public static int CLIPBRD_E_CANT_EMPTY = unchecked((int)0x800401D1);
        public static int CLIPBRD_E_CANT_OPEN = unchecked((int)0x800401D0);
        public static int CLIPBRD_E_CANT_SET = unchecked((int)0x800401D2);
        public static int CLIPBRD_E_FIRST = unchecked((int)0x800401D0);
        public static int CLIPBRD_E_LAST = unchecked((int)0x800401DF);
        public static int CLIPBRD_S_FIRST = 0x401D0;
        public static int CLIPBRD_S_LAST = 0x401DF;
        public static int CONVERT10_E_FIRST = unchecked((int)0x800401C0);
        public static int CONVERT10_E_LAST = unchecked((int)0x800401CF);
        public static int CONVERT10_E_OLESTREAM_BITMAP_TO_DIB = unchecked((int)0x800401C3);
        public static int CONVERT10_E_OLESTREAM_FMT = unchecked((int)0x800401C2);
        public static int CONVERT10_E_OLESTREAM_GET = unchecked((int)0x800401C0);
        public static int CONVERT10_E_OLESTREAM_PUT = unchecked((int)0x800401C1);
        public static int CONVERT10_E_STG_DIB_TO_BITMAP = unchecked((int)0x800401C6);
        public static int CONVERT10_E_STG_FMT = unchecked((int)0x800401C4);
        public static int CONVERT10_E_STG_NO_STD_STREAM = unchecked((int)0x800401C5);
        public static int CONVERT10_S_FIRST = 0x401C0;
        public static int CONVERT10_S_LAST = 0x401CF;
        public static int CONVERT10_S_NO_PRESENTATION = 0x401C0;
        public static int CO_E_ALREADYINITIALIZED = unchecked((int)0x800401F1);
        public static int CO_E_APPDIDNTREG = unchecked((int)0x800401FE);
        public static int CO_E_APPNOTFOUND = unchecked((int)0x800401F5);
        public static int CO_E_APPSINGLEUSE = unchecked((int)0x800401F6);
        public static int CO_E_BAD_PATH = unchecked((int)0x80080004);
        public static int CO_E_CANTDETERMINECLASS = unchecked((int)0x800401F2);
        public static int CO_E_CLASSSTRING = unchecked((int)0x800401F3);
        public static int CO_E_CLASS_CREATE_FAILED = unchecked((int)0x80080001);
        public static int CO_E_DLLNOTFOUND = unchecked((int)0x800401F8);
        public static int CO_E_ERRORINAPP = unchecked((int)0x800401F7);
        public static int CO_E_ERRORINDLL = unchecked((int)0x800401F9);
        public static int CO_E_FIRST = unchecked((int)0x800401F0);
        public static int CO_E_IIDSTRING = unchecked((int)0x800401F4);
        public static int CO_E_INIT_CLASS_CACHE = unchecked((int)0x80004009);
        public static int CO_E_INIT_MEMORY_ALLOCATOR = unchecked((int)0x80004008);
        public static int CO_E_INIT_ONLY_SINGLE_THREADED = unchecked((int)0x80004012);
        public static int CO_E_INIT_RPC_CHANNEL = unchecked((int)0x8000400A);
        public static int CO_E_INIT_SCM_EXEC_FAILURE = unchecked((int)0x80004011);
        public static int CO_E_INIT_SCM_FILE_MAPPING_EXISTS = unchecked((int)0x8000400F);
        public static int CO_E_INIT_SCM_MAP_VIEW_OF_FILE = unchecked((int)0x80004010);
        public static int CO_E_INIT_SCM_MUTEX_EXISTS = unchecked((int)0x8000400E);
        public static int CO_E_INIT_SHARED_ALLOCATOR = unchecked((int)0x80004007);
        public static int CO_E_INIT_TLS = unchecked((int)0x80004006);
        public static int CO_E_INIT_TLS_CHANNEL_CONTROL = unchecked((int)0x8000400C);
        public static int CO_E_INIT_TLS_SET_CHANNEL_CONTROL = unchecked((int)0x8000400B);
        public static int CO_E_INIT_UNACCEPTED_USER_ALLOCATOR = unchecked((int)0x8000400D);
        public static int CO_E_LAST = unchecked((int)0x800401FF);
        public static int CO_E_NOTINITIALIZED = unchecked((int)0x800401F0);
        public static int CO_E_OBJISREG = unchecked((int)0x800401FC);
        public static int CO_E_OBJNOTCONNECTED = unchecked((int)0x800401FD);
        public static int CO_E_OBJNOTREG = unchecked((int)0x800401FB);
        public static int CO_E_OBJSRV_RPC_FAILURE = unchecked((int)0x80080006);
        public static int CO_E_RELEASED = unchecked((int)0x800401FF);
        public static int CO_E_SCM_ERROR = unchecked((int)0x80080002);
        public static int CO_E_SCM_RPC_FAILURE = unchecked((int)0x80080003);
        public static int CO_E_SERVER_EXEC_FAILURE = unchecked((int)0x80080005);
        public static int CO_E_SERVER_STOPPING = unchecked((int)0x80080008);
        public static int CO_E_WRONGOSFORAPP = unchecked((int)0x800401FA);
        public static int CO_S_FIRST = 0x401F0;
        public static int CO_S_LAST = 0x401FF;
        public static int DATA_E_FIRST = unchecked((int)0x80040130);
        public static int DATA_E_LAST = unchecked((int)0x8004013F);
        public static int DATA_S_FIRST = 0x40130;
        public static int DATA_S_LAST = 0x4013F;
        public static int DATA_S_SAMEFORMATETC = 0x40130;
        public static int DISP_E_ARRAYISLOCKED = unchecked((int)0x8002000D);
        public static int DISP_E_BADCALLEE = unchecked((int)0x80020010);
        public static int DISP_E_BADINDEX = unchecked((int)0x8002000B);
        public static int DISP_E_BADPARAMCOUNT = unchecked((int)0x8002000E);
        public static int DISP_E_BADVARTYPE = unchecked((int)0x80020008);
        public static int DISP_E_EXCEPTION = unchecked((int)0x80020009);
        public static int DISP_E_MEMBERNOTFOUND = unchecked((int)0x80020003);
        public static int DISP_E_NONAMEDARGS = unchecked((int)0x80020007);
        public static int DISP_E_NOTACOLLECTION = unchecked((int)0x80020011);
        public static int DISP_E_OVERFLOW = unchecked((int)0x8002000A);
        public static int DISP_E_PARAMNOTFOUND = unchecked((int)0x80020004);
        public static int DISP_E_PARAMNOTOPTIONAL = unchecked((int)0x8002000F);
        public static int DISP_E_TYPEMISMATCH = unchecked((int)0x80020005);
        public static int DISP_E_UNKNOWNINTERFACE = unchecked((int)0x80020001);
        public static int DISP_E_UNKNOWNLCID = unchecked((int)0x8002000C);
        public static int DISP_E_UNKNOWNNAME = unchecked((int)0x80020006);
        public static int DRAGDROP_E_ALREADYREGISTERED = unchecked((int)0x80040101);
        public static int DRAGDROP_E_FIRST = unchecked((int)0x80040100);
        public static int DRAGDROP_E_INVALIDIntPtr = unchecked((int)0x80040102);
        public static int DRAGDROP_E_LAST = unchecked((int)0x8004010F);
        public static int DRAGDROP_E_NOTREGISTERED = unchecked((int)0x80040100);
        public static int DRAGDROP_S_CANCEL = 0x40101;
        public static int DRAGDROP_S_DROP = 0x40100;
        public static int DRAGDROP_S_FIRST = 0x40100;
        public static int DRAGDROP_S_LAST = 0x4010F;
        public static int DRAGDROP_S_USEDEFAULTCURSORS = 0x40102;
        public static int DV_E_CLIPFORMAT = unchecked((int)0x8004006A);
        public static int DV_E_DVASPECT = unchecked((int)0x8004006B);
        public static int DV_E_DVTARGETDEVICE = unchecked((int)0x80040065);
        public static int DV_E_DVTARGETDEVICE_SIZE = unchecked((int)0x8004006C);
        public static int DV_E_FORMATETC = unchecked((int)0x80040064);
        public static int DV_E_LINDEX = unchecked((int)0x80040068);
        public static int DV_E_NOIVIEWOBJECT = unchecked((int)0x8004006D);
        public static int DV_E_STATDATA = unchecked((int)0x80040067);
        public static int DV_E_STGMEDIUM = unchecked((int)0x80040066);
        public static int DV_E_TYMED = unchecked((int)0x80040069);
        public static int ENUM_E_FIRST = unchecked((int)0x800401B0);
        public static int ENUM_E_LAST = unchecked((int)0x800401BF);
        public static int ENUM_S_FIRST = 0x401B0;
        public static int ENUM_S_LAST = 0x401BF;
        public static int EPT_S_CANT_CREATE = 1899;
        public static int EPT_S_CANT_PERFORM_OP = 1752;
        public static int EPT_S_INVALID_ENTRY = 1751;
        public static int EPT_S_NOT_REGISTERED = 1753;
        public static int ERROR_ACCESS_DENIED = 5;
        public static int ERROR_ACCOUNT_DISABLED = 1331;
        public static int ERROR_ACCOUNT_EXPIRED = 1793;
        public static int ERROR_ACCOUNT_RESTRICTION = 1327;
        public static int ERROR_ADAP_HDW_ERR = 57;
        public static int ERROR_ALIAS_EXISTS = 1379;
        public static int ERROR_ALLOTTED_SPACE_EXCEEDED = 1344;
        public static int ERROR_ALREADY_ASSIGNED = 85;
        public static int ERROR_ALREADY_EXISTS = 183;
        public static int ERROR_ALREADY_RUNNING_LKG = 1074;
        public static int ERROR_ALREADY_WAITING = 1904;
        public static int ERROR_ARENA_TRASHED = 7;
        public static int ERROR_ARITHMETIC_OVERFLOW = 534;
        public static int ERROR_ATOMIC_LOCKS_NOT_SUPPORTED = 174;
        public static int ERROR_AUTODATASEG_EXCEEDS_64k = 199;
        public static int ERROR_BADDB = 1009;
        public static int ERROR_BADKEY = 1010;
        public static int ERROR_BAD_ARGUMENTS = 160;
        public static int ERROR_BAD_COMMAND = 22;
        public static int ERROR_BAD_DESCRIPTOR_FORMAT = 1361;
        public static int ERROR_BAD_DEVICE = 1200;
        public static int ERROR_BAD_DEV_TYPE = 66;
        public static int ERROR_BAD_DRIVER = 2001;
        public static int ERROR_BAD_DRIVER_LEVEL = 119;
        public static int ERROR_BAD_ENVIRONMENT = 10;
        public static int ERROR_BAD_EXE_FORMAT = 193;
        public static int ERROR_BAD_FORMAT = 11;
        public static int ERROR_BAD_IMPERSONATION_LEVEL = 1346;
        public static int ERROR_BAD_INHERITANCE_ACL = 1340;
        public static int ERROR_BAD_LENGTH = 24;
        public static int ERROR_BAD_LOGON_SESSION_STATE = 1365;
        public static int ERROR_BAD_NETPATH = 53;
        public static int ERROR_BAD_NET_NAME = 67;
        public static int ERROR_BAD_NET_RESP = 58;
        public static int ERROR_BAD_PATHNAME = 161;
        public static int ERROR_BAD_PIPE = 230;
        public static int ERROR_BAD_PROFILE = 1206;
        public static int ERROR_BAD_PROVIDER = 1204;
        public static int ERROR_BAD_REM_ADAP = 60;
        public static int ERROR_BAD_THREADID_ADDR = 159;
        public static int ERROR_BAD_TOKEN_TYPE = 1349;
        public static int ERROR_BAD_UNIT = 20;
        public static int ERROR_BAD_USERNAME = 2202;
        public static int ERROR_BAD_VALIDATION_CLASS = 1348;
        public static int ERROR_BEGINNING_OF_MEDIA = 1102;
        public static int ERROR_BOOT_ALREADY_ACCEPTED = 1076;
        public static int ERROR_BROKEN_PIPE = 109;
        public static int ERROR_BUFFER_OVERFLOW = 111;
        public static int ERROR_BUSY = 170;
        public static int ERROR_BUSY_DRIVE = 142;
        public static int ERROR_BUS_RESET = 1111;
        public static int ERROR_CALL_NOT_IMPLEMENTED = 120;
        public static int ERROR_CANCEL_VIOLATION = 173;
        public static int ERROR_CANNOT_COPY = 266;
        public static int ERROR_CANNOT_FIND_WND_CLASS = 1407;
        public static int ERROR_CANNOT_IMPERSONATE = 1368;
        public static int ERROR_CANNOT_MAKE = 82;
        public static int ERROR_CANNOT_OPEN_PROFILE = 1205;
        public static int ERROR_CANTOPEN = 1011;
        public static int ERROR_CANTREAD = 1012;
        public static int ERROR_CANTWRITE = 1013;
        public static int ERROR_CANT_ACCESS_DOMAIN_INFO = 1351;
        public static int ERROR_CANT_DISABLE_MANDATORY = 1310;
        public static int ERROR_CANT_OPEN_ANONYMOUS = 1347;
        public static int ERROR_CAN_NOT_COMPLETE = 1003;
        public static int ERROR_CAN_NOT_DEL_LOCAL_WINS = 4001;
        public static int ERROR_CHILD_MUST_BE_VOLATILE = 1021;
        public static int ERROR_CHILD_NOT_COMPLETE = 129;
        public static int ERROR_CHILD_WINDOW_MENU = 1436;
        public static int ERROR_CIRCULAR_DEPENDENCY = 1059;
        public static int ERROR_CLASS_ALREADY_EXISTS = 1410;
        public static int ERROR_CLASS_DOES_NOT_EXIST = 1411;
        public static int ERROR_CLASS_HAS_WINDOWS = 1412;
        public static int ERROR_CLIPBOARD_NOT_OPEN = 1418;
        public static int ERROR_CLIPPING_NOT_SUPPORTED = 2005;
        public static int ERROR_CONNECTION_UNAVAIL = 1201;
        public static int ERROR_CONTROL_ID_NOT_FOUND = 1421;
        public static int ERROR_COUNTER_TIMEOUT = 1121;
        public static int ERROR_CRC = 23;
        public static int ERROR_CURRENT_DIRECTORY = 16;
        public static int ERROR_DATABASE_DOES_NOT_EXIST = 1065;
        public static int ERROR_DC_NOT_FOUND = 1425;
        public static int ERROR_DEPENDENT_SERVICES_RUNNING = 1051;
        public static int ERROR_DESTROY_OBJECT_OF_OTHER_THREAD = 1435;
        public static int ERROR_DEVICE_ALREADY_REMEMBERED = 1202;
        public static int ERROR_DEVICE_IN_USE = 2404;
        public static int ERROR_DEVICE_NOT_PARTITIONED = 1107;
        public static int ERROR_DEV_NOT_EXIST = 55;
        public static int ERROR_DIRECTORY = 267;
        public static int ERROR_DIRECT_ACCESS_IntPtr = 130;
        public static int ERROR_DIR_NOT_EMPTY = 145;
        public static int ERROR_DIR_NOT_ROOT = 144;
        public static int ERROR_DISCARDED = 157;
        public static int ERROR_DISK_CHANGE = 107;
        public static int ERROR_DISK_CORRUPT = 1393;
        public static int ERROR_DISK_FULL = 112;
        public static int ERROR_DISK_OPERATION_FAILED = 1127;
        public static int ERROR_DISK_RECALIBRATE_FAILED = 1126;
        public static int ERROR_DISK_RESET_FAILED = 1128;
        public static int ERROR_DLL_INIT_FAILED = 1114;
        public static int ERROR_DOMAIN_EXISTS = 1356;
        public static int ERROR_DOMAIN_LIMIT_EXCEEDED = 1357;
        public static int ERROR_DOMAIN_TRUST_INCONSISTENT = 1810;
        public static int ERROR_DRIVE_LOCKED = 108;
        public static int ERROR_DUPLICATE_SERVICE_NAME = 1078;
        public static int ERROR_DUP_DOMAINNAME = 1221;
        public static int ERROR_DUP_NAME = 52;
        public static int ERROR_DYNLINK_FROM_INVALID_RING = 196;
        public static int ERROR_EAS_DIDNT_FIT = 275;
        public static int ERROR_EAS_NOT_SUPPORTED = 282;
        public static int ERROR_EA_ACCESS_DENIED = 994;
        public static int ERROR_EA_FILE_CORRUPT = 276;
        public static int ERROR_EA_LIST_INCONSISTENT = 255;
        public static int ERROR_EA_TABLE_FULL = 277;
        public static int ERROR_END_OF_MEDIA = 1100;
        public static int ERROR_ENVVAR_NOT_FOUND = 203;
        public static int ERROR_EOM_OVERFLOW = 1129;
        public static int ERROR_EVENTLOG_CANT_START = 1501;
        public static int ERROR_EVENTLOG_FILE_CHANGED = 1503;
        public static int ERROR_EVENTLOG_FILE_CORRUPT = 1500;
        public static int ERROR_EXCEPTION_IN_SERVICE = 1064;
        public static int ERROR_EXCL_SEM_ALREADY_OWNED = 101;
        public static int ERROR_EXE_MARKED_INVALID = 192;
        public static int ERROR_EXTENDED_ERROR = 1208;
        public static int ERROR_FAILED_SERVICE_CONTROLLER_CONNECT = 1063;
        public static int ERROR_FAIL_I24 = 83;
        public static int ERROR_FILEMARK_DETECTED = 1101;
        public static int ERROR_FILENAME_EXCED_RANGE = 206;
        public static int ERROR_FILE_CORRUPT = 1392;
        public static int ERROR_FILE_EXISTS = 80;
        public static int ERROR_FILE_INVALID = 1006;
        public static int ERROR_FILE_NOT_FOUND = 2;
        public static int ERROR_FLOPPY_BAD_REGISTERS = 1125;
        public static int ERROR_FLOPPY_ID_MARK_NOT_FOUND = 1122;
        public static int ERROR_FLOPPY_UNKNOWN_ERROR = 1124;
        public static int ERROR_FLOPPY_WRONG_CYLINDER = 1123;
        public static int ERROR_FULLSCREEN_MODE = 1007;
        public static int ERROR_FULL_BACKUP = 4004;
        public static int ERROR_GENERIC_NOT_MAPPED = 1360;
        public static int ERROR_GEN_FAILURE = 31;
        public static int ERROR_GROUP_EXISTS = 1318;
        public static int ERROR_IntPtr_DISK_FULL = 39;
        public static int ERROR_IntPtr_EOF = 38;
        public static int ERROR_HOOK_NEEDS_HMOD = 1428;
        public static int ERROR_HOOK_NOT_INSTALLED = 1431;
        public static int ERROR_HOTKEY_ALREADY_REGISTERED = 1409;
        public static int ERROR_HOTKEY_NOT_REGISTERED = 1419;
        public static int ERROR_IntPtrS_HAVE_DIFF_PARENT = 1441;
        public static int ERROR_ILL_FORMED_PASSWORD = 1324;
        public static int ERROR_INC_BACKUP = 4003;
        public static int ERROR_INFLOOP_IN_RELOC_CHAIN = 202;
        public static int ERROR_INSUFFICIENT_BUFFER = 122;
        public static int ERROR_INTERNAL_DB_CORRUPTION = 1358;
        public static int ERROR_INTERNAL_DB_ERROR = 1383;
        public static int ERROR_INTERNAL_ERROR = 1359;
        public static int ERROR_INVALID_ACCEL_IntPtr = 1403;
        public static int ERROR_INVALID_ACCESS = 12;
        public static int ERROR_INVALID_ACCOUNT_NAME = 1315;
        public static int ERROR_INVALID_ACL = 1336;
        public static int ERROR_INVALID_ADDRESS = 487;
        public static int ERROR_INVALID_AT_INTERRUPT_TIME = 104;
        public static int ERROR_INVALID_BLOCK = 9;
        public static int ERROR_INVALID_BLOCK_LENGTH = 1106;
        public static int ERROR_INVALID_CATEGORY = 117;
        public static int ERROR_INVALID_COMBOBOX_MESSAGE = 1422;
        public static int ERROR_INVALID_COMPUTERNAME = 1210;
        public static int ERROR_INVALID_CURSOR_IntPtr = 1402;
        public static int ERROR_INVALID_DATA = 13;
        public static int ERROR_INVALID_DATATYPE = 1804;
        public static int ERROR_INVALID_DOMAINNAME = 1212;
        public static int ERROR_INVALID_DOMAIN_ROLE = 1354;
        public static int ERROR_INVALID_DOMAIN_STATE = 1353;
        public static int ERROR_INVALID_DRIVE = 15;
        public static int ERROR_INVALID_DWP_IntPtr = 1405;
        public static int ERROR_INVALID_EA_IntPtr = 278;
        public static int ERROR_INVALID_EA_NAME = 254;
        public static int ERROR_INVALID_EDIT_HEIGHT = 1424;
        public static int ERROR_INVALID_ENVIRONMENT = 1805;
        public static int ERROR_INVALID_EVENTNAME = 1211;
        public static int ERROR_INVALID_EVENT_COUNT = 151;
        public static int ERROR_INVALID_EXE_SIGNATURE = 191;
        public static int ERROR_INVALID_FILTER_PROC = 1427;
        public static int ERROR_INVALID_FLAGS = 1004;
        public static int ERROR_INVALID_FLAG_NUMBER = 186;
        public static int ERROR_INVALID_FORM_NAME = 1902;
        public static int ERROR_INVALID_FORM_SIZE = 1903;
        public static int ERROR_INVALID_FUNCTION = 1;
        public static int ERROR_INVALID_GROUPNAME = 1209;
        public static int ERROR_INVALID_GROUP_ATTRIBUTES = 1345;
        public static int ERROR_INVALID_GW_COMMAND = 1443;
        public static int ERROR_INVALID_IntPtr = 6;
        public static int ERROR_INVALID_HOOK_FILTER = 1426;
        public static int ERROR_INVALID_HOOK_IntPtr = 1404;
        public static int ERROR_INVALID_ICON_IntPtr = 1414;
        public static int ERROR_INVALID_ID_AUTHORITY = 1343;
        public static int ERROR_INVALID_INDEX = 1413;
        public static int ERROR_INVALID_LB_MESSAGE = 1432;
        public static int ERROR_INVALID_LEVEL = 124;
        public static int ERROR_INVALID_LIST_FORMAT = 153;
        public static int ERROR_INVALID_LOGON_HOURS = 1328;
        public static int ERROR_INVALID_LOGON_TYPE = 1367;
        public static int ERROR_INVALID_MEMBER = 1388;
        public static int ERROR_INVALID_MENU_IntPtr = 1401;
        public static int ERROR_INVALID_MESSAGE = 1002;
        public static int ERROR_INVALID_MESSAGEDEST = 1218;
        public static int ERROR_INVALID_MESSAGENAME = 1217;
        public static int ERROR_INVALID_MINALLOCSIZE = 195;
        public static int ERROR_INVALID_MODULETYPE = 190;
        public static int ERROR_INVALID_MSGBOX_STYLE = 1438;
        public static int ERROR_INVALID_NAME = 123;
        public static int ERROR_INVALID_NETNAME = 1214;
        public static int ERROR_INVALID_ORDINAL = 182;
        public static int ERROR_INVALID_OWNER = 1307;
        public static int ERROR_INVALID_PARAMETER = 87;
        public static int ERROR_INVALID_PASSWORD = 86;
        public static int ERROR_INVALID_PASSWORDNAME = 1216;
        public static int ERROR_INVALID_PIXEL_FORMAT = 2000;
        public static int ERROR_INVALID_PRIMARY_GROUP = 1308;
        public static int ERROR_INVALID_PRINTER_COMMAND = 1803;
        public static int ERROR_INVALID_PRINTER_NAME = 1801;
        public static int ERROR_INVALID_PRINTER_STATE = 1906;
        public static int ERROR_INVALID_PRIORITY = 1800;
        public static int ERROR_INVALID_SCROLLBAR_RANGE = 1448;
        public static int ERROR_INVALID_SECURITY_DESCR = 1338;
        public static int ERROR_INVALID_SEGDPL = 198;
        public static int ERROR_INVALID_SEGMENT_NUMBER = 180;
        public static int ERROR_INVALID_SEPARATOR_FILE = 1799;
        public static int ERROR_INVALID_SERVER_STATE = 1352;
        public static int ERROR_INVALID_SERVICENAME = 1213;
        public static int ERROR_INVALID_SERVICE_ACCOUNT = 1057;
        public static int ERROR_INVALID_SERVICE_CONTROL = 1052;
        public static int ERROR_INVALID_SERVICE_LOCK = 1071;
        public static int ERROR_INVALID_SHARENAME = 1215;
        public static int ERROR_INVALID_SHOWWIN_COMMAND = 1449;
        public static int ERROR_INVALID_SID = 1337;
        public static int ERROR_INVALID_SIGNAL_NUMBER = 209;
        public static int ERROR_INVALID_SPI_VALUE = 1439;
        public static int ERROR_INVALID_STACKSEG = 189;
        public static int ERROR_INVALID_STARTING_CODESEG = 188;
        public static int ERROR_INVALID_SUB_AUTHORITY = 1335;
        public static int ERROR_INVALID_TARGET_IntPtr = 114;
        public static int ERROR_INVALID_THREAD_ID = 1444;
        public static int ERROR_INVALID_TIME = 1901;
        public static int ERROR_INVALID_USER_BUFFER = 1784;
        public static int ERROR_INVALID_VERIFY_SWITCH = 118;
        public static int ERROR_INVALID_WINDOW_IntPtr = 1400;
        public static int ERROR_INVALID_WINDOW_STYLE = 2002;
        public static int ERROR_INVALID_WORKSTATION = 1329;
        public static int ERROR_IOPL_NOT_ENABLED = 197;
        public static int ERROR_IO_DEVICE = 1117;
        public static int ERROR_IO_INCOMPLETE = 996;
        public static int ERROR_IO_PENDING = 997;
        public static int ERROR_IRQ_BUSY = 1119;
        public static int ERROR_IS_JOINED = 134;
        public static int ERROR_IS_JOIN_PATH = 147;
        public static int ERROR_IS_JOIN_TARGET = 133;
        public static int ERROR_IS_SUBSTED = 135;
        public static int ERROR_IS_SUBST_PATH = 146;
        public static int ERROR_IS_SUBST_TARGET = 149;
        public static int ERROR_ITERATED_DATA_EXCEEDS_64k = 194;
        public static int ERROR_JOIN_TO_JOIN = 138;
        public static int ERROR_JOIN_TO_SUBST = 140;
        public static int ERROR_JOURNAL_HOOK_SET = 1430;
        public static int ERROR_KEY_DELETED = 1018;
        public static int ERROR_KEY_HAS_CHILDREN = 1020;
        public static int ERROR_LABEL_TOO_LONG = 154;
        public static int ERROR_LAST_ADMIN = 1322;
        public static int ERROR_LB_WITHOUT_TABSTOPS = 1434;
        public static int ERROR_LISTBOX_ID_NOT_FOUND = 1416;
        public static int ERROR_LM_CROSS_ENCRYPTION_REQUIRED = 1390;
        public static int ERROR_LOCAL_USER_SESSION_KEY = 1303;
        public static int ERROR_LOCKED = 212;
        public static int ERROR_LOCK_FAILED = 167;
        public static int ERROR_LOCK_VIOLATION = 33;
        public static int ERROR_LOGON_FAILURE = 1326;
        public static int ERROR_LOGON_NOT_GRANTED = 1380;
        public static int ERROR_LOGON_SESSION_COLLISION = 1366;
        public static int ERROR_LOGON_SESSION_EXISTS = 1363;
        public static int ERROR_LOGON_TYPE_NOT_GRANTED = 1385;
        public static int ERROR_LOG_FILE_FULL = 1502;
        public static int ERROR_LUIDS_EXHAUSTED = 1334;
        public static int ERROR_MAPPED_ALIGNMENT = 1132;
        public static int ERROR_MAX_THRDS_REACHED = 164;
        public static int ERROR_MEDIA_CHANGED = 1110;
        public static int ERROR_MEMBERS_PRIMARY_GROUP = 1374;
        public static int ERROR_MEMBER_IN_ALIAS = 1378;
        public static int ERROR_MEMBER_IN_GROUP = 1320;
        public static int ERROR_MEMBER_NOT_IN_ALIAS = 1377;
        public static int ERROR_MEMBER_NOT_IN_GROUP = 1321;
        public static int ERROR_METAFILE_NOT_SUPPORTED = 2003;
        public static int ERROR_META_EXPANSION_TOO_LONG = 208;
        public static int ERROR_MOD_NOT_FOUND = 126;
        public static int ERROR_MORE_DATA = 234;
        public static int ERROR_MORE_WRITES = 1120;
        public static int ERROR_MR_MID_NOT_FOUND = 317;
        public static int ERROR_NEGATIVE_SEEK = 131;
        public static int ERROR_NESTING_NOT_ALLOWED = 215;
        public static int ERROR_NETLOGON_NOT_STARTED = 1792;
        public static int ERROR_NETNAME_DELETED = 64;
        public static int ERROR_NETWORK_ACCESS_DENIED = 65;
        public static int ERROR_NETWORK_BUSY = 54;
        public static int ERROR_NET_WRITE_FAULT = 88;
        public static int ERROR_NOACCESS = 998;
        public static int ERROR_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT = 1807;
        public static int ERROR_NOLOGON_SERVER_TRUST_ACCOUNT = 1809;
        public static int ERROR_NOLOGON_WORKSTATION_TRUST_ACCOUNT = 1808;
        public static int ERROR_NONE_MAPPED = 1332;
        public static int ERROR_NON_MDICHILD_WINDOW = 1445;
        public static int ERROR_NOTIFY_ENUM_DIR = 1022;
        public static int ERROR_NOT_ALL_ASSIGNED = 1300;
        public static int ERROR_NOT_CHILD_WINDOW = 1442;
        public static int ERROR_NOT_CONNECTED = 2250;
        public static int ERROR_NOT_CONTAINER = 1207;
        public static int ERROR_NOT_DOS_DISK = 26;
        public static int ERROR_NOT_ENOUGH_MEMORY = 8;
        public static int ERROR_NOT_ENOUGH_QUOTA = 1816;
        public static int ERROR_NOT_ENOUGH_SERVER_MEMORY = 1130;
        public static int ERROR_NOT_JOINED = 136;
        public static int ERROR_NOT_LOCKED = 158;
        public static int ERROR_NOT_LOGON_PROCESS = 1362;
        public static int ERROR_NOT_OWNER = 288;
        public static int ERROR_NOT_READY = 21;
        public static int ERROR_NOT_REGISTRY_FILE = 1017;
        public static int ERROR_NOT_SAME_DEVICE = 17;
        public static int ERROR_NOT_SUBSTED = 137;
        public static int ERROR_NOT_SUPPORTED = 50;
        public static int ERROR_NO_BROWSER_SERVERS_FOUND = 6118;
        public static int ERROR_NO_DATA = 232;
        public static int ERROR_NO_DATA_DETECTED = 1104;
        public static int ERROR_NO_IMPERSONATION_TOKEN = 1309;
        public static int ERROR_NO_INHERITANCE = 1391;
        public static int ERROR_NO_LOGON_SERVERS = 1311;
        public static int ERROR_NO_LOG_SPACE = 1019;
        public static int ERROR_NO_MEDIA_IN_DRIVE = 1112;
        public static int ERROR_NO_MORE_FILES = 18;
        public static int ERROR_NO_MORE_ITEMS = 259;
        public static int ERROR_NO_MORE_SEARCH_IntPtrS = 113;
        public static int ERROR_NO_NETWORK = 1222;
        public static int ERROR_NO_NET_OR_BAD_PATH = 1203;
        public static int ERROR_NO_PROC_SLOTS = 89;
        public static int ERROR_NO_QUOTAS_FOR_ACCOUNT = 1302;
        public static int ERROR_NO_SCROLLBARS = 1447;
        public static int ERROR_NO_SECURITY_ON_OBJECT = 1350;
        public static int ERROR_NO_SHUTDOWN_IN_PROGRESS = 1116;
        public static int ERROR_NO_SIGNAL_SENT = 205;
        public static int ERROR_NO_SPOOL_SPACE = 62;
        public static int ERROR_NO_SUCH_ALIAS = 1376;
        public static int ERROR_NO_SUCH_DOMAIN = 1355;
        public static int ERROR_NO_SUCH_GROUP = 1319;
        public static int ERROR_NO_SUCH_LOGON_SESSION = 1312;
        public static int ERROR_NO_SUCH_MEMBER = 1387;
        public static int ERROR_NO_SUCH_PACKAGE = 1364;
        public static int ERROR_NO_SUCH_PRIVILEGE = 1313;
        public static int ERROR_NO_SUCH_USER = 1317;
        public static int ERROR_NO_SYSTEM_MENU = 1437;
        public static int ERROR_NO_TOKEN = 1008;
        public static int ERROR_NO_TRUST_LSA_SECRET = 1786;
        public static int ERROR_NO_TRUST_SAM_ACCOUNT = 1787;
        public static int ERROR_NO_UNICODE_TRANSLATION = 1113;
        public static int ERROR_NO_USER_SESSION_KEY = 1394;
        public static int ERROR_NO_VOLUME_LABEL = 125;
        public static int ERROR_NO_WILDCARD_CHARACTERS = 1417;
        public static int ERROR_NT_CROSS_ENCRYPTION_REQUIRED = 1386;
        public static int ERROR_NULL_LM_PASSWORD = 1304;
        public static int ERROR_OPEN_FAILED = 110;
        public static int ERROR_OPEN_FILES = 2401;
        public static int ERROR_OPERATION_ABORTED = 995;
        public static int ERROR_OUTOFMEMORY = 14;
        public static int ERROR_OUT_OF_PAPER = 28;
        public static int ERROR_OUT_OF_STRUCTURES = 84;
        public static int ERROR_PARTITION_FAILURE = 1105;
        public static int ERROR_PASSWORD_EXPIRED = 1330;
        public static int ERROR_PASSWORD_RESTRICTION = 1325;
        public static int ERROR_PATH_BUSY = 148;
        public static int ERROR_PATH_NOT_FOUND = 3;
        public static int ERROR_PIPE_BUSY = 231;
        public static int ERROR_PIPE_CONNECTED = 535;
        public static int ERROR_PIPE_LISTENING = 536;
        public static int ERROR_PIPE_NOT_CONNECTED = 233;
        public static int ERROR_POPUP_ALREADY_ACTIVE = 1446;
        public static int ERROR_POSSIBLE_DEADLOCK = 1131;
        public static int ERROR_PRINTER_ALREADY_EXISTS = 1802;
        public static int ERROR_PRINTER_DELETED = 1905;
        public static int ERROR_PRINTER_DRIVER_ALREADY_INSTALLED = 1795;
        public static int ERROR_PRINTER_DRIVER_IN_USE = 3001;
        public static int ERROR_PRINTQ_FULL = 61;
        public static int ERROR_PRINT_CANCELLED = 63;
        public static int ERROR_PRINT_MONITOR_ALREADY_INSTALLED = 3006;
        public static int ERROR_PRINT_PROCESSOR_ALREADY_INSTALLED = 3005;
        public static int ERROR_PRIVATE_DIALOG_INDEX = 1415;
        public static int ERROR_PRIVILEGE_NOT_HELD = 1314;
        public static int ERROR_PROCESS_ABORTED = 1067;
        public static int ERROR_PROC_NOT_FOUND = 127;
        public static int ERROR_PUBLIC_ONLY_HOOK = 1429;
        public static int ERROR_READ_FAULT = 30;
        public static int ERROR_REC_NON_EXISTENT = 4005;
        public static int ERROR_REDIRECTOR_HAS_OPEN_IntPtrS = 1794;
        public static int ERROR_REDIR_PAUSED = 72;
        public static int ERROR_REGISTRY_CORRUPT = 1015;
        public static int ERROR_REGISTRY_IO_FAILED = 1016;
        public static int ERROR_REGISTRY_RECOVERED = 1014;
        public static int ERROR_RELOC_CHAIN_XEEDS_SEGLIM = 201;
        public static int ERROR_REMOTE_SESSION_LIMIT_EXCEEDED = 1220;
        public static int ERROR_REM_NOT_LIST = 51;
        public static int ERROR_REQ_NOT_ACCEP = 71;
        public static int ERROR_RESOURCE_DATA_NOT_FOUND = 1812;
        public static int ERROR_RESOURCE_LANG_NOT_FOUND = 1815;
        public static int ERROR_RESOURCE_NAME_NOT_FOUND = 1814;
        public static int ERROR_RESOURCE_TYPE_NOT_FOUND = 1813;
        public static int ERROR_REVISION_MISMATCH = 1306;
        public static int ERROR_RING2SEG_MUST_BE_MOVABLE = 200;
        public static int ERROR_RING2_STACK_IN_USE = 207;
        public static int ERROR_RPL_NOT_ALLOWED = 4006;
        public static int ERROR_RXACT_COMMIT_FAILURE = 1370;
        public static int ERROR_RXACT_INVALID_STATE = 1369;
        public static int ERROR_SAME_DRIVE = 143;
        public static int ERROR_SCREEN_ALREADY_LOCKED = 1440;
        public static int ERROR_SECRET_TOO_LONG = 1382;
        public static int ERROR_SECTOR_NOT_FOUND = 27;
        public static int ERROR_SEEK = 25;
        public static int ERROR_SEEK_ON_DEVICE = 132;
        public static int ERROR_SEM_IS_SET = 102;
        public static int ERROR_SEM_NOT_FOUND = 187;
        public static int ERROR_SEM_OWNER_DIED = 105;
        public static int ERROR_SEM_TIMEOUT = 121;
        public static int ERROR_SEM_USER_LIMIT = 106;
        public static int ERROR_SERIAL_NO_DEVICE = 1118;
        public static int ERROR_SERVER_DISABLED = 1341;
        public static int ERROR_SERVER_HAS_OPEN_IntPtrS = 1811;
        public static int ERROR_SERVER_NOT_DISABLED = 1342;
        public static int ERROR_SERVICE_ALREADY_RUNNING = 1056;
        public static int ERROR_SERVICE_CANNOT_ACCEPT_CTRL = 1061;
        public static int ERROR_SERVICE_DATABASE_LOCKED = 1055;
        public static int ERROR_SERVICE_DEPENDENCY_DELETED = 1075;
        public static int ERROR_SERVICE_DEPENDENCY_FAIL = 1068;
        public static int ERROR_SERVICE_DISABLED = 1058;
        public static int ERROR_SERVICE_DOES_NOT_EXIST = 1060;
        public static int ERROR_SERVICE_EXISTS = 1073;
        public static int ERROR_SERVICE_LOGON_FAILED = 1069;
        public static int ERROR_SERVICE_MARKED_FOR_DELETE = 1072;
        public static int ERROR_SERVICE_NEVER_STARTED = 1077;
        public static int ERROR_SERVICE_NOT_ACTIVE = 1062;
        public static int ERROR_SERVICE_NO_THREAD = 1054;
        public static int ERROR_SERVICE_REQUEST_TIMEOUT = 1053;
        public static int ERROR_SERVICE_SPECIFIC_ERROR = 1066;
        public static int ERROR_SERVICE_START_HANG = 1070;
        public static int ERROR_SESSION_CREDENTIAL_CONFLICT = 1219;
        public static int ERROR_SETCOUNT_ON_BAD_LB = 1433;
        public static int ERROR_SETMARK_DETECTED = 1103;
        public static int ERROR_SHARING_BUFFER_EXCEEDED = 36;
        public static int ERROR_SHARING_PAUSED = 70;
        public static int ERROR_SHARING_VIOLATION = 32;
        public static int ERROR_SHUTDOWN_IN_PROGRESS = 1115;
        public static int ERROR_SIGNAL_PENDING = 162;
        public static int ERROR_SIGNAL_REFUSED = 156;
        public static int ERROR_SOME_NOT_MAPPED = 1301;
        public static int ERROR_SPECIAL_ACCOUNT = 1371;
        public static int ERROR_SPECIAL_GROUP = 1372;
        public static int ERROR_SPECIAL_USER = 1373;
        public static int ERROR_SPL_NO_ADDJOB = 3004;
        public static int ERROR_SPL_NO_STARTDOC = 3003;
        public static int ERROR_SPOOL_FILE_NOT_FOUND = 3002;
        public static int ERROR_STACK_OVERFLOW = 1001;
        public static int ERROR_STATIC_INIT = 4002;
        public static int ERROR_SUBST_TO_JOIN = 141;
        public static int ERROR_SUBST_TO_SUBST = 139;
        public static int ERROR_SUCCESS = 0;
        public static int ERROR_SWAPERROR = 999;
        public static int ERROR_SYSTEM_TRACE = 150;
        public static int ERROR_THREAD_1_INACTIVE = 210;
        public static int ERROR_TLW_WITH_WSCHILD = 1406;
        public static int ERROR_TOKEN_ALREADY_IN_USE = 1375;
        public static int ERROR_TOO_MANY_CMDS = 56;
        public static int ERROR_TOO_MANY_CONTEXT_IDS = 1384;
        public static int ERROR_TOO_MANY_LUIDS_REQUESTED = 1333;
        public static int ERROR_TOO_MANY_MODULES = 214;
        public static int ERROR_TOO_MANY_MUXWAITERS = 152;
        public static int ERROR_TOO_MANY_NAMES = 68;
        public static int ERROR_TOO_MANY_OPEN_FILES = 4;
        public static int ERROR_TOO_MANY_POSTS = 298;
        public static int ERROR_TOO_MANY_SECRETS = 1381;
        public static int ERROR_TOO_MANY_SEMAPHORES = 100;
        public static int ERROR_TOO_MANY_SEM_REQUESTS = 103;
        public static int ERROR_TOO_MANY_SESS = 69;
        public static int ERROR_TOO_MANY_SIDS = 1389;
        public static int ERROR_TOO_MANY_TCBS = 155;
        public static int ERROR_TRANSFORM_NOT_SUPPORTED = 2004;
        public static int ERROR_TRUSTED_DOMAIN_FAILURE = 1788;
        public static int ERROR_TRUSTED_RELATIONSHIP_FAILURE = 1789;
        public static int ERROR_TRUST_FAILURE = 1790;
        public static int ERROR_UNABLE_TO_LOCK_MEDIA = 1108;
        public static int ERROR_UNABLE_TO_UNLOAD_MEDIA = 1109;
        public static int ERROR_UNEXP_NET_ERR = 59;
        public static int ERROR_UNKNOWN_PORT = 1796;
        public static int ERROR_UNKNOWN_PRINTER_DRIVER = 1797;
        public static int ERROR_UNKNOWN_PRINTPROCESSOR = 1798;
        public static int ERROR_UNKNOWN_PRINT_MONITOR = 3000;
        public static int ERROR_UNKNOWN_REVISION = 1305;
        public static int ERROR_UNRECOGNIZED_MEDIA = 1785;
        public static int ERROR_UNRECOGNIZED_VOLUME = 1005;
        public static int ERROR_USER_EXISTS = 1316;
        public static int ERROR_VC_DISCONNECTED = 240;
        public static int ERROR_WAIT_NO_CHILDREN = 128;
        public static int ERROR_WINDOW_NOT_COMBOBOX = 1423;
        public static int ERROR_WINDOW_NOT_DIALOG = 1420;
        public static int ERROR_WINDOW_OF_OTHER_THREAD = 1408;
        public static int ERROR_WINS_INTERNAL = 4000;
        public static int ERROR_WRITE_FAULT = 29;
        public static int ERROR_WRITE_PROTECT = 19;
        public static int ERROR_WRONG_DISK = 34;
        public static int ERROR_WRONG_PASSWORD = 1323;
        public static int E_ABORT = unchecked((int)0x80004004);
        public static int E_ACCESSDENIED = unchecked((int)0x80070005);
        public static int E_FAIL = unchecked((int)0x80004005);
        public static int E_IntPtr = unchecked((int)0x80070006);
        public static int E_INVALIDARG = unchecked((int)0x80070057);
        public static int E_NOINTERFACE = unchecked((int)0x80004002);
        public static int E_NOTIMPL = unchecked((int)0x80004001);
        public static int E_OUTOFMEMORY = unchecked((int)0x8007000E);
        public static int E_POINTER = unchecked((int)0x80004003);
        public static int E_UNEXPECTED = unchecked((int)0x8000FFFF);
        public static int FACILITY_NT_BIT = 0x10000000;
        public static int INPLACE_E_FIRST = unchecked((int)0x800401A0);
        public static int INPLACE_E_LAST = unchecked((int)0x800401AF);
        public static int INPLACE_E_NOTOOLSPACE = unchecked((int)0x800401A1);
        public static int INPLACE_E_NOTUNDOABLE = unchecked((int)0x800401A0);
        public static int INPLACE_S_FIRST = 0x401A0;
        public static int INPLACE_S_LAST = 0x401AF;
        public static int INPLACE_S_TRUNCATED = 0x401A0;
        public static int MARSHAL_E_FIRST = unchecked((int)0x80040120);
        public static int MARSHAL_E_LAST = unchecked((int)0x8004012F);
        public static int MARSHAL_S_FIRST = 0x40120;
        public static int MARSHAL_S_LAST = 0x4012F;
        public static int MEM_E_INVALID_LINK = unchecked((int)0x80080010);
        public static int MEM_E_INVALID_ROOT = unchecked((int)0x80080009);
        public static int MEM_E_INVALID_SIZE = unchecked((int)0x80080011);
        public static int MK_E_CANTOPENFILE = unchecked((int)0x800401EA);
        public static int MK_E_CONNECTMANUALLY = unchecked((int)0x800401E0);
        public static int MK_E_ENUMERATION_FAILED = unchecked((int)0x800401EF);
        public static int MK_E_EXCEEDEDDEADLINE = unchecked((int)0x800401E1);
        public static int MK_E_FIRST = unchecked((int)0x800401E0);
        public static int MK_E_INTERMEDIATEINTERFACENOTSUPPORTED = unchecked((int)0x800401E7);
        public static int MK_E_INVALIDEXTENSION = unchecked((int)0x800401E6);
        public static int MK_E_LAST = unchecked((int)0x800401EF);
        public static int MK_E_MUSTBOTHERUSER = unchecked((int)0x800401EB);
        public static int MK_E_NEEDGENERIC = unchecked((int)0x800401E2);
        public static int MK_E_NOINVERSE = unchecked((int)0x800401EC);
        public static int MK_E_NOOBJECT = unchecked((int)0x800401E5);
        public static int MK_E_NOPREFIX = unchecked((int)0x800401EE);
        public static int MK_E_NOSTORAGE = unchecked((int)0x800401ED);
        public static int MK_E_NOTBINDABLE = unchecked((int)0x800401E8);
        public static int MK_E_NOTBOUND = unchecked((int)0x800401E9);
        public static int MK_E_NO_NORMALIZED = unchecked((int)0x80080007);
        public static int MK_E_SYNTAX = unchecked((int)0x800401E4);
        public static int MK_E_UNAVAILABLE = unchecked((int)0x800401E3);
        public static int MK_S_FIRST = 0x401E0;
        public static int MK_S_HIM = 0x401E5;
        public static int MK_S_LAST = 0x401EF;
        public static int MK_S_ME = 0x401E4;
        public static int MK_S_MONIKERALREADYREGISTERED = 0x401E7;
        public static int MK_S_REDUCED_TO_SELF = 0x401E2;
        public static int MK_S_US = 0x401E6;
        public static int NOERROR = 0;
        public static int NO_ERROR = 0;
        public static int OLEOBJ_E_FIRST = unchecked((int)0x80040180);
        public static int OLEOBJ_E_INVALIDVERB = unchecked((int)0x80040181);
        public static int OLEOBJ_E_LAST = unchecked((int)0x8004018F);
        public static int OLEOBJ_E_NOVERBS = unchecked((int)0x80040180);
        public static int OLEOBJ_S_CANNOT_DOVERB_NOW = 0x40181;
        public static int OLEOBJ_S_FIRST = 0x40180;
        public static int OLEOBJ_S_INVALIDIntPtr = 0x40182;
        public static int OLEOBJ_S_INVALIDVERB = 0x40180;
        public static int OLEOBJ_S_LAST = 0x4018F;
        public static int OLE_E_ADVF = unchecked((int)0x80040001);
        public static int OLE_E_ADVISENOTSUPPORTED = unchecked((int)0x80040003);
        public static int OLE_E_BLANK = unchecked((int)0x80040007);
        public static int OLE_E_CANTCONVERT = unchecked((int)0x80040011);
        public static int OLE_E_CANT_BINDTOSOURCE = unchecked((int)0x8004000A);
        public static int OLE_E_CANT_GETMONIKER = unchecked((int)0x80040009);
        public static int OLE_E_CLASSDIFF = unchecked((int)0x80040008);
        public static int OLE_E_ENUM_NOMORE = unchecked((int)0x80040002);
        public static int OLE_E_FIRST = unchecked((int)0x80040000);
        public static int OLE_E_INVALIDIntPtr = unchecked((int)0x8004000F);
        public static int OLE_E_INVALIDRECT = unchecked((int)0x8004000D);
        public static int OLE_E_LAST = unchecked((int)0x800400FF);
        public static int OLE_E_NOCACHE = unchecked((int)0x80040006);
        public static int OLE_E_NOCONNECTION = unchecked((int)0x80040004);
        public static int OLE_E_NOSTORAGE = unchecked((int)0x80040012);
        public static int OLE_E_NOTRUNNING = unchecked((int)0x80040005);
        public static int OLE_E_NOT_INPLACEACTIVE = unchecked((int)0x80040010);
        public static int OLE_E_OLEVERB = unchecked((int)0x80040000);
        public static int OLE_E_PROMPTSAVECANCELLED = unchecked((int)0x8004000C);
        public static int OLE_E_STATIC = unchecked((int)0x8004000B);
        public static int OLE_E_WRONGCOMPOBJ = unchecked((int)0x8004000E);
        public static int OLE_S_FIRST = 0x40000;
        public static int OLE_S_LAST = 0x400FF;
        public static int OLE_S_MAC_CLIPFORMAT = 0x40002;
        public static int OLE_S_STATIC = 0x40001;
        public static int OLE_S_USEREG = 0x40000;
        public static int REGDB_E_CLASSNOTREG = unchecked((int)0x80040154);
        public static int REGDB_E_FIRST = unchecked((int)0x80040150);
        public static int REGDB_E_IIDNOTREG = unchecked((int)0x80040155);
        public static int REGDB_E_INVALIDVALUE = unchecked((int)0x80040153);
        public static int REGDB_E_KEYMISSING = unchecked((int)0x80040152);
        public static int REGDB_E_LAST = unchecked((int)0x8004015F);
        public static int REGDB_E_READREGDB = unchecked((int)0x80040150);
        public static int REGDB_E_WRITEREGDB = unchecked((int)0x80040151);
        public static int REGDB_S_FIRST = 0x40150;
        public static int REGDB_S_LAST = 0x4015F;
        public static int RPC_E_ATTEMPTED_MULTITHREAD = unchecked((int)0x80010102);
        public static int RPC_E_CALL_CANCELED = unchecked((int)0x80010002);
        public static int RPC_E_CALL_REJECTED = unchecked((int)0x80010001);
        public static int RPC_E_CANTCALLOUT_AGAIN = unchecked((int)0x80010011);
        public static int RPC_E_CANTCALLOUT_INASYNCCALL = unchecked((int)0x80010004);
        public static int RPC_E_CANTCALLOUT_INEXTERNALCALL = unchecked((int)0x80010005);
        public static int RPC_E_CANTCALLOUT_ININPUTSYNCCALL = unchecked((int)0x8001010D);
        public static int RPC_E_CANTPOST_INSENDCALL = unchecked((int)0x80010003);
        public static int RPC_E_CANTTRANSMIT_CALL = unchecked((int)0x8001000A);
        public static int RPC_E_CHANGED_MODE = unchecked((int)0x80010106);
        public static int RPC_E_CLIENT_CANTMARSHAL_DATA = unchecked((int)0x8001000B);
        public static int RPC_E_CLIENT_CANTUNMARSHAL_DATA = unchecked((int)0x8001000C);
        public static int RPC_E_CLIENT_DIED = unchecked((int)0x80010008);
        public static int RPC_E_CONNECTION_TERMINATED = unchecked((int)0x80010006);
        public static int RPC_E_DISCONNECTED = unchecked((int)0x80010108);
        public static int RPC_E_FAULT = unchecked((int)0x80010104);
        public static int RPC_E_INVALIDMETHOD = unchecked((int)0x80010107);
        public static int RPC_E_INVALID_CALLDATA = unchecked((int)0x8001010C);
        public static int RPC_E_INVALID_DATA = unchecked((int)0x8001000F);
        public static int RPC_E_INVALID_DATAPACKET = unchecked((int)0x80010009);
        public static int RPC_E_INVALID_PARAMETER = unchecked((int)0x80010010);
        public static int RPC_E_NOT_REGISTERED = unchecked((int)0x80010103);
        public static int RPC_E_OUT_OF_RESOURCES = unchecked((int)0x80010101);
        public static int RPC_E_RETRY = unchecked((int)0x80010109);
        public static int RPC_E_SERVERCALL_REJECTED = unchecked((int)0x8001010B);
        public static int RPC_E_SERVERCALL_RETRYLATER = unchecked((int)0x8001010A);
        public static int RPC_E_SERVERFAULT = unchecked((int)0x80010105);
        public static int RPC_E_SERVER_CANTMARSHAL_DATA = unchecked((int)0x8001000D);
        public static int RPC_E_SERVER_CANTUNMARSHAL_DATA = unchecked((int)0x8001000E);
        public static int RPC_E_SERVER_DIED = unchecked((int)0x80010007);
        public static int RPC_E_SERVER_DIED_DNE = unchecked((int)0x80010012);
        public static int RPC_E_SYS_CALL_FAILED = unchecked((int)0x80010100);
        public static int RPC_E_THREAD_NOT_INIT = unchecked((int)0x8001010F);
        public static int RPC_E_UNEXPECTED = unchecked((int)0x8001FFFF);
        public static int RPC_E_WRONG_THREAD = unchecked((int)0x8001010E);
        public static int RPC_S_ADDRESS_ERROR = 1768;
        public static int RPC_S_ALREADY_LISTENING = 1713;
        public static int RPC_S_ALREADY_REGISTERED = 1711;
        public static int RPC_S_BINDING_HAS_NO_AUTH = 1746;
        public static int RPC_S_CALL_FAILED = 1726;
        public static int RPC_S_CALL_FAILED_DNE = 1727;
        public static int RPC_S_CALL_IN_PROGRESS = 1791;
        public static int RPC_S_CANNOT_SUPPORT = 1764;
        public static int RPC_S_CANT_CREATE_ENDPOINT = 1720;
        public static int RPC_S_DUPLICATE_ENDPOINT = 1740;
        public static int RPC_S_ENTRY_ALREADY_EXISTS = 1760;
        public static int RPC_S_ENTRY_NOT_FOUND = 1761;
        public static int RPC_S_FP_DIV_ZERO = 1769;
        public static int RPC_S_FP_OVERFLOW = 1771;
        public static int RPC_S_FP_UNDERFLOW = 1770;
        public static int RPC_S_GROUP_MEMBER_NOT_FOUND = 1898;
        public static int RPC_S_INCOMPLETE_NAME = 1755;
        public static int RPC_S_INTERFACE_NOT_FOUND = 1759;
        public static int RPC_S_INTERNAL_ERROR = 1766;
        public static int RPC_S_INVALID_AUTH_IDENTITY = 1749;
        public static int RPC_S_INVALID_BINDING = 1702;
        public static int RPC_S_INVALID_BOUND = 1734;
        public static int RPC_S_INVALID_ENDPOINT_FORMAT = 1706;
        public static int RPC_S_INVALID_NAF_ID = 1763;
        public static int RPC_S_INVALID_NAME_SYNTAX = 1736;
        public static int RPC_S_INVALID_NETWORK_OPTIONS = 1724;
        public static int RPC_S_INVALID_NET_ADDR = 1707;
        public static int RPC_S_INVALID_OBJECT = 1900;
        public static int RPC_S_INVALID_RPC_PROTSEQ = 1704;
        public static int RPC_S_INVALID_STRING_BINDING = 1700;
        public static int RPC_S_INVALID_STRING_UUID = 1705;
        public static int RPC_S_INVALID_TAG = 1733;
        public static int RPC_S_INVALID_TIMEOUT = 1709;
        public static int RPC_S_INVALID_VERS_OPTION = 1756;
        public static int RPC_S_MAX_CALLS_TOO_SMALL = 1742;
        public static int RPC_S_NAME_SERVICE_UNAVAILABLE = 1762;
        public static int RPC_S_NOTHING_TO_EXPORT = 1754;
        public static int RPC_S_NOT_ALL_OBJS_UNEXPORTED = 1758;
        public static int RPC_S_NOT_LISTENING = 1715;
        public static int RPC_S_NO_BINDINGS = 1718;
        public static int RPC_S_NO_CALL_ACTIVE = 1725;
        public static int RPC_S_NO_CONTEXT_AVAILABLE = 1765;
        public static int RPC_S_NO_ENDPOINT_FOUND = 1708;
        public static int RPC_S_NO_ENTRY_NAME = 1735;
        public static int RPC_S_NO_MORE_BINDINGS = 1806;
        public static int RPC_S_NO_MORE_MEMBERS = 1757;
        public static int RPC_S_NO_PROTSEQS = 1719;
        public static int RPC_S_NO_PROTSEQS_REGISTERED = 1714;
        public static int RPC_S_OBJECT_NOT_FOUND = 1710;
        public static int RPC_S_OUT_OF_RESOURCES = 1721;
        public static int RPC_S_PROCNUM_OUT_OF_RANGE = 1745;
        public static int RPC_S_PROTOCOL_ERROR = 1728;
        public static int RPC_S_PROTSEQ_NOT_FOUND = 1744;
        public static int RPC_S_PROTSEQ_NOT_SUPPORTED = 1703;
        public static int RPC_S_SERVER_TOO_BUSY = 1723;
        public static int RPC_S_SERVER_UNAVAILABLE = 1722;
        public static int RPC_S_STRING_TOO_LONG = 1743;
        public static int RPC_S_TYPE_ALREADY_REGISTERED = 1712;
        public static int RPC_S_UNKNOWN_AUTHN_LEVEL = 1748;
        public static int RPC_S_UNKNOWN_AUTHN_SERVICE = 1747;
        public static int RPC_S_UNKNOWN_AUTHN_TYPE = 1741;
        public static int RPC_S_UNKNOWN_AUTHZ_SERVICE = 1750;
        public static int RPC_S_UNKNOWN_IF = 1717;
        public static int RPC_S_UNKNOWN_MGR_TYPE = 1716;
        public static int RPC_S_UNSUPPORTED_NAME_SYNTAX = 1737;
        public static int RPC_S_UNSUPPORTED_TRANS_SYN = 1730;
        public static int RPC_S_UNSUPPORTED_TYPE = 1732;
        public static int RPC_S_UUID_NO_ADDRESS = 1739;
        public static int RPC_S_WRONG_KIND_OF_BINDING = 1701;
        public static int RPC_S_ZERO_DIVIDE = 1767;
        public static int RPC_X_BAD_STUB_DATA = 1783;
        public static int RPC_X_BYTE_COUNT_TOO_SMALL = 1782;
        public static int RPC_X_ENUM_VALUE_OUT_OF_RANGE = 1781;
        public static int RPC_X_NO_MORE_ENTRIES = 1772;
        public static int RPC_X_NULL_REF_POINTER = 1780;
        public static int RPC_X_SS_CANNOT_GET_CALL_IntPtr = 1779;
        public static int RPC_X_SS_CHAR_TRANS_OPEN_FAIL = 1773;
        public static int RPC_X_SS_CHAR_TRANS_SHORT_FILE = 1774;
        public static int RPC_X_SS_CONTEXT_DAMAGED = 1777;
        public static int RPC_X_SS_IntPtrS_MISMATCH = 1778;
        public static int RPC_X_SS_IN_NULL_CONTEXT = 1775;
        public static int SEVERITY_ERROR = 1;
        public static int SEVERITY_SUCCESS = 0;
        public static int STG_E_ABNORMALAPIEXIT = unchecked((int)0x800300FA);
        public static int STG_E_ACCESSDENIED = unchecked((int)0x80030005);
        public static int STG_E_CANTSAVE = unchecked((int)0x80030103);
        public static int STG_E_DISKISWRITEPROTECTED = unchecked((int)0x80030013);
        public static int STG_E_EXTANTMARSHALLINGS = unchecked((int)0x80030108);
        public static int STG_E_FILEALREADYEXISTS = unchecked((int)0x80030050);
        public static int STG_E_FILENOTFOUND = unchecked((int)0x80030002);
        public static int STG_E_INSUFFICIENTMEMORY = unchecked((int)0x80030008);
        public static int STG_E_INUSE = unchecked((int)0x80030100);
        public static int STG_E_INVALIDFLAG = unchecked((int)0x800300FF);
        public static int STG_E_INVALIDFUNCTION = unchecked((int)0x80030001);
        public static int STG_E_INVALIDIntPtr = unchecked((int)0x80030006);
        public static int STG_E_INVALIDHEADER = unchecked((int)0x800300FB);
        public static int STG_E_INVALIDNAME = unchecked((int)0x800300FC);
        public static int STG_E_INVALIDPARAMETER = unchecked((int)0x80030057);
        public static int STG_E_INVALIDPOINTER = unchecked((int)0x80030009);
        public static int STG_E_LOCKVIOLATION = unchecked((int)0x80030021);
        public static int STG_E_MEDIUMFULL = unchecked((int)0x80030070);
        public static int STG_E_NOMOREFILES = unchecked((int)0x80030012);
        public static int STG_E_NOTCURRENT = unchecked((int)0x80030101);
        public static int STG_E_NOTFILEBASEDSTORAGE = unchecked((int)0x80030107);
        public static int STG_E_OLDDLL = unchecked((int)0x80030105);
        public static int STG_E_OLDFORMAT = unchecked((int)0x80030104);
        public static int STG_E_PATHNOTFOUND = unchecked((int)0x80030003);
        public static int STG_E_READFAULT = unchecked((int)0x8003001E);
        public static int STG_E_REVERTED = unchecked((int)0x80030102);
        public static int STG_E_SEEKERROR = unchecked((int)0x80030019);
        public static int STG_E_SHAREREQUIRED = unchecked((int)0x80030106);
        public static int STG_E_SHAREVIOLATION = unchecked((int)0x80030020);
        public static int STG_E_TOOMANYOPENFILES = unchecked((int)0x80030004);
        public static int STG_E_UNIMPLEMENTEDFUNCTION = unchecked((int)0x800300FE);
        public static int STG_E_UNKNOWN = unchecked((int)0x800300FD);
        public static int STG_E_WRITEFAULT = unchecked((int)0x8003001D);
        public static int STG_S_CONVERTED = unchecked((int)0x30200);
        public static int S_FALSE = 0x1;
        public static int S_OK = 0x0;
        public static int TYPE_E_AMBIGUOUSNAME = unchecked((int)0x8002802C);
        public static int TYPE_E_BADMODULEKIND = unchecked((int)0x800288BD);
        public static int TYPE_E_BUFFERTOOSMALL = unchecked((int)0x80028016);
        public static int TYPE_E_CANTCREATETMPFILE = unchecked((int)0x80028CA3);
        public static int TYPE_E_CANTLOADLIBRARY = unchecked((int)0x80029C4A);
        public static int TYPE_E_CIRCULARTYPE = unchecked((int)0x80029C84);
        public static int TYPE_E_DLLFUNCTIONNOTFOUND = unchecked((int)0x8002802F);
        public static int TYPE_E_DUPLICATEID = unchecked((int)0x800288C6);
        public static int TYPE_E_ELEMENTNOTFOUND = unchecked((int)0x8002802B);
        public static int TYPE_E_INCONSISTENTPROPFUNCS = unchecked((int)0x80029C83);
        public static int TYPE_E_INVALIDID = unchecked((int)0x800288CF);
        public static int TYPE_E_INVALIDSTATE = unchecked((int)0x80028029);
        public static int TYPE_E_INVDATAREAD = unchecked((int)0x80028018);
        public static int TYPE_E_IOERROR = unchecked((int)0x80028CA2);
        public static int TYPE_E_LIBNOTREGISTERED = unchecked((int)0x8002801D);
        public static int TYPE_E_NAMECONFLICT = unchecked((int)0x8002802D);
        public static int TYPE_E_OUTOFBOUNDS = unchecked((int)0x80028CA1);
        public static int TYPE_E_QUALIFIEDNAMEDISALLOWED = unchecked((int)0x80028028);
        public static int TYPE_E_REGISTRYACCESS = unchecked((int)0x8002801C);
        public static int TYPE_E_SIZETOOBIG = unchecked((int)0x800288C5);
        public static int TYPE_E_TYPEMISMATCH = unchecked((int)0x80028CA0);
        public static int TYPE_E_UNDEFINEDTYPE = unchecked((int)0x80028027);
        public static int TYPE_E_UNKNOWNLCID = unchecked((int)0x8002802E);
        public static int TYPE_E_UNSUPFORMAT = unchecked((int)0x80028019);
        public static int TYPE_E_WRONGTYPEKIND = unchecked((int)0x8002802A);
        public static int VIEW_E_DRAW = unchecked((int)0x80040140);
        public static int VIEW_E_FIRST = unchecked((int)0x80040140);
        public static int VIEW_E_LAST = unchecked((int)0x8004014F);
        public static int VIEW_S_ALREADY_FROZEN = 0x40140;
        public static int VIEW_S_FIRST = 0x40140;
        public static int VIEW_S_LAST = 0x4014F;
        #endregion

        #region Non-imported
        #region Properties
        /// <summary>
        /// Gets whether the current OS is Windows NT or later.
        /// </summary>
        public static bool Windows
        { get { return Environment.OSVersion.Platform == PlatformID.Win32NT; } }

        /// <summary>
        /// Gets whether the current OS is Windows Vista or later.
        /// </summary>
        public static bool WinVista
        { get { return Windows == true && Environment.OSVersion.Version.Major >= 6; } }

        /// <summary>
        /// Gets whether the current OS is Windows XP or later.
        /// </summary>
        public static bool WinXP
        { get { return Windows == true && Environment.OSVersion.Version.Major >= 5; } }
        #endregion

        #region Methods
        public static bool IsKeyPressed(Keys k)
        {
            int s = (int)GetAsyncKeyState((int)k);
            s = (s & 0x8000) >> 15;
            return (s == 1);
        }

        public static IntPtr ControlDC(Control control)
        { return GetDC(control.Handle); }

        public static int ColorToInt(Color color)
        { return (color.B << 16 | color.G << 8 | color.R); }

        public static Color IntToColor(int color)
        {
            int b = (color >> 16) & 0xFF;
            int g = (color >> 8) & 0xFF;
            int r = (color) & 0xFF;
            return Color.FromArgb(r, g, b);
        }
        #endregion
        #endregion
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The GNU Lesser General Public License (LGPLv3)



Comments and Discussions