// win/windows.h : windows definitions for WIN layer //------------------------------------------------------------------------------ #begin unsafe //------------------------------------------------------------------------------ typedef char CHAR; typedef wchar WCHAR; typedef byte BYTE; typedef uint2 WORD; typedef uint2 USHORT; typedef uint4 DWORD; typedef uint4 UINT; typedef uint4 ULONG; typedef int2 SHORT; typedef int BOOL; typedef int4 INT; typedef int4 LONG; typedef int4 HRESULT; typedef WORD ATOM; typedef int4 LRESULT; typedef uint4 SIZE_T; typedef DWORD COLORREF; typedef DWORD* DWORD_PTR; typedef int* int_PTR; typedef uint UINT_PTR; typedef void TIMERPROC(); typedef long ULARGE_INTEGER; typedef long LONGLONG; typedef long ULONGLONG; typedef long DWORDLONG; typedef uint WPARAM; typedef int LPARAM; typedef uint HINSTANCE; typedef uint HICON; typedef uint HCURSOR; typedef uint HBRUSH; typedef uint HANDLE; typedef uint HMODULE; typedef uint HWND; typedef uint HMENU; typedef uint HDC; typedef uint HRGN; typedef uint HBITMAP; typedef uint HFONT; typedef uint HPEN; typedef uint HGDIOBJ; typedef uint HGLOBAL; typedef uint HACCEL; typedef uint HRSRC; typedef char* LPCSTR; typedef char* LPSTR; typedef wchar* LPCWSTR; typedef wchar* LPWSTR; typedef byte* MENUTEMPLATEA; typedef byte* MENUTEMPLATEW; typedef byte* PVOID; typedef byte* LPVOID; typedef char* LPCTSTR; typedef DWORD D3DCOLOR; typedef float FLOAT; typedef double DOUBLE; typedef byte* RGNDATA; const BOOL FALSE = 0; const BOOL TRUE = 1; typedef [callback] int WNDPROC (HWND hwnd, uint message, uint lparam, int hparam); const uint IDC_ARROW = 32512; const uint IDC_IBEAM = 32513; const uint IDC_WAIT = 32514; const uint IDC_CROSS = 32515; const uint IDI_APPLICATION = 32512; const uint WS_OVERLAPPED = 0x00000000; const uint WS_POPUP = 0x80000000; const uint WS_CHILD = 0x40000000; const uint WS_MINIMIZE = 0x20000000; const uint WS_VISIBLE = 0x10000000; const uint WS_DISABLED = 0x08000000; const uint WS_CLIPSIBLINGS = 0x04000000; const uint WS_CLIPCHILDREN = 0x02000000; const uint WS_MAXIMIZE = 0x01000000; const uint WS_CAPTION = 0x00C00000; const uint WS_BORDER = 0x00800000; const uint WS_DLGFRAME = 0x00400000; const uint WS_VSCROLL = 0x00200000; const uint WS_HSCROLL = 0x00100000; const uint WS_SYSMENU = 0x00080000; const uint WS_THICKFRAME = 0x00040000; const uint WS_GROUP = 0x00020000; const uint WS_TABSTOP = 0x00010000; const uint WS_MINIMIZEBOX = 0x00020000; const uint WS_MAXIMIZEBOX = 0x00010000; const uint WS_TILED = WS_OVERLAPPED; const uint WS_ICONIC = WS_MINIMIZE; const uint WS_SIZEBOX = WS_THICKFRAME; const uint WS_OVERLAPPEDWINDOW= (WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX); const uint WS_TILEDWINDOW = WS_OVERLAPPEDWINDOW; const uint WS_POPUPWINDOW = (WS_POPUP | WS_BORDER | WS_SYSMENU); const uint WS_CHILDWINDOW = (WS_CHILD); const int CW_USEDEFAULT = int'min; const uint SW_HIDE = 0; const uint SW_SHOW = 5; const uint SW_MAXIMIZE = 3; const uint SW_MINIMIZE = 6; const uint SW_RESTORE = 9; const uint SW_SHOWDEFAULT = 10; [extern "KERNEL32.dll"] uint GetModuleHandleA (char *str); [extern "KERNEL32.dll"] uint GetModuleHandleW (wchar *str); [extern "KERNEL32.dll"] int GetLastError(); [extern "user32.dll"] HCURSOR LoadCursorA (HINSTANCE hinstance, uint id); [extern "user32.dll"] HCURSOR LoadCursorW (HINSTANCE hinstance, uint id); [extern "user32.dll"] HICON LoadIconA (HINSTANCE hinstance, uint id); [extern "user32.dll"] HICON LoadIconW (HINSTANCE hinstance, uint id); [extern "comctl32.dll"] void InitCommonControls(); packed struct INITCOMMONCONTROLSEX { DWORD dwSize; DWORD dwICC; } const DWORD ICC_LISTVIEW_CLASSES = 0x00000001; // listview, header const DWORD ICC_TREEVIEW_CLASSES = 0x00000002; // treeview, tooltips const DWORD ICC_BAR_CLASSES = 0x00000004; // toolbar, statusbar, trackbar, tooltips const DWORD ICC_TAB_CLASSES = 0x00000008; // tab, tooltips const DWORD ICC_UPDOWN_CLASS = 0x00000010; // updown const DWORD ICC_PROGRESS_CLASS = 0x00000020; // progress const DWORD ICC_HOTKEY_CLASS = 0x00000040; // hotkey const DWORD ICC_ANIMATE_CLASS = 0x00000080; // animate const DWORD ICC_WIN95_CLASSES = 0x000000FF; const DWORD ICC_DATE_CLASSES = 0x00000100; // month picker, date picker, time picker, updown const DWORD ICC_USEREX_CLASSES = 0x00000200; // comboex const DWORD ICC_COOL_CLASSES = 0x00000400; // rebar (coolbar) control const DWORD ICC_INTERNET_CLASSES = 0x00000800; const DWORD ICC_PAGESCROLLER_CLASS = 0x00001000; // page scroller const DWORD ICC_NATIVEFNTCTL_CLASS = 0x00002000; // native font control [extern "comctl32.dll"] BOOL InitCommonControlsEx (INITCOMMONCONTROLSEX lpInitCtrls); struct WNDCLASSA { uint style; WNDPROC lpfnWndProc; int cbClsExtra; int cbWndExtra; HINSTANCE hInstance; HICON hIcon; HCURSOR hCursor; HBRUSH hbrBackground; LPCSTR lpszMenuName; LPCSTR lpszClassName; } [extern "user32.dll"] ATOM RegisterClassA (WNDCLASSA wc); struct WNDCLASSEXA { UINT cbSize; UINT style; WNDPROC lpfnWndProc; int cbClsExtra; int cbWndExtra; HINSTANCE hInstance; HICON hIcon; HCURSOR hCursor; HBRUSH hbrBackground; LPCSTR lpszMenuName; LPCSTR lpszClassName; HICON hIconSm; } [extern "user32.dll"] ATOM RegisterClassExA (WNDCLASSEXA wc); struct WNDCLASSEXW { UINT cbSize; UINT style; WNDPROC lpfnWndProc; int cbClsExtra; int cbWndExtra; HINSTANCE hInstance; HICON hIcon; HCURSOR hCursor; HBRUSH hbrBackground; LPCWSTR lpszMenuName; LPCWSTR lpszClassName; HICON hIconSm; } [extern "user32.dll"] ATOM RegisterClassExW (WNDCLASSEXW wc); [extern "user32.dll"] HWND CreateWindowExA (uint exstyles, char *class, char *title, DWORD style, int x, int y, int width, int height, HWND parent, HMENU menu, HANDLE hinstance, int lparam); [extern "user32.dll"] HWND CreateWindowExW (uint exstyles, wchar *class, wchar *title, DWORD style, int x, int y, int width, int height, HWND parent, HMENU menu, HANDLE hinstance, int lparam); [extern "user32.dll"] BOOL ShowWindow (HWND hwnd, uint nCmdShow); [extern "user32.dll"] BOOL EnableWindow (HWND hWnd, BOOL bEnable); [extern "user32.dll"] void SetForegroundWindow (HWND hwnd); [extern "user32.dll"] HWND SetFocus(HWND hWnd); [extern "user32.dll"] HWND SetActiveWindow(HWND hWnd); packed struct RECT { int left; int top; int right; int bottom; } packed struct COLORKEY { DWORD KeyType; DWORD PaletteIndex; COLORREF LowColorValue; COLORREF HighColorValue; } [extern "user32.dll"] BOOL InvalidateRgn (HWND hWnd, HRGN hRgn, BOOL bErase); [extern "user32.dll"] BOOL ValidateRgn (HWND hWnd, HRGN hRgn); [extern "user32.dll"] BOOL RedrawWindow (HWND hWnd, RECT *lprcUpdate, HRGN hrgnUpdate, UINT flags); const uint RDW_INVALIDATE = 0x0001; const uint RDW_INTERNALPAINT = 0x0002; const uint RDW_ERASE = 0x0004; const uint RDW_VALIDATE = 0x0008; const uint RDW_NOINTERNALPAINT = 0x0010; const uint RDW_NOERASE = 0x0020; const uint RDW_NOCHILDREN = 0x0040; const uint RDW_ALLCHILDREN = 0x0080; const uint RDW_UPDATENOW = 0x0100; const uint RDW_ERASENOW = 0x0200; const uint RDW_FRAME = 0x0400; const uint RDW_NOFRAME = 0x0800; [extern "user32.dll"] LRESULT DefWindowProcA (HWND hwnd, uint message, uint wparam, int lparam); [extern "user32.dll"] LRESULT DefWindowProcW (HWND hwnd, uint message, uint wparam, int lparam); const int GWL_WNDPROC = (-4); const int GWL_HINSTANCE = (-6); const int GWL_HWNDPARENT = (-8); const int GWL_STYLE = (-16); const int GWL_EXSTYLE = (-20); const int GWL_USERDATA = (-21); const int GWL_ID = (-12); [extern "user32.dll"] byte* GetWindowLongA (HWND hWnd, int nIndex); [extern "user32.dll"] LONG GetWindowLongW (HWND hWnd, int nIndex); [extern "user32.dll"] LONG SetWindowLongA (HWND hWnd, int nIndex, byte* dwNewLong); [extern "user32.dll"] LONG SetWindowLongW (HWND hWnd, int nIndex, LONG dwNewLong); const uint LWA_COLORKEY = 0x00000001; const uint LWA_ALPHA = 0x00000002; const uint ULW_COLORKEY = 0x00000001; const uint ULW_ALPHA = 0x00000002; const uint ULW_OPAQUE = 0x00000004; const uint WS_EX_DLGMODALFRAME = 0x00000001; const uint WS_EX_NOPARENTNOTIFY = 0x00000004; const uint WS_EX_TOPMOST = 0x00000008; const uint WS_EX_ACCEPTFILES = 0x00000010; const uint WS_EX_TRANSPARENT = 0x00000020; const uint WS_EX_MDICHILD = 0x00000040; const uint WS_EX_TOOLWINDOW = 0x00000080; const uint WS_EX_WINDOWEDGE = 0x00000100; const uint WS_EX_CLIENTEDGE = 0x00000200; const uint WS_EX_CONTEXTHELP = 0x00000400; const uint WS_EX_RIGHT = 0x00001000; const uint WS_EX_LEFT = 0x00000000; const uint WS_EX_RTLREADING = 0x00002000; const uint WS_EX_LTRREADING = 0x00000000; const uint WS_EX_LEFTSCROLLBAR = 0x00004000; const uint WS_EX_RIGHTSCROLLBAR = 0x00000000; const uint WS_EX_CONTROLPARENT = 0x00010000; const uint WS_EX_STATICEDGE = 0x00020000; const uint WS_EX_APPWINDOW = 0x00040000; const uint WS_EX_OVERLAPPEDWINDOW = (WS_EX_WINDOWEDGE | WS_EX_CLIENTEDGE); const uint WS_EX_PALETTEWINDOW = (WS_EX_WINDOWEDGE | WS_EX_TOOLWINDOW | WS_EX_TOPMOST); const uint WS_EX_LAYERED = 0x00080000; const uint WS_EX_COMPOSITED = 0x02000000; [extern "user32.dll"] BOOL SetLayeredWindowAttributes (HWND hwnd, COLORREF crKey, BYTE bAlpha, DWORD dwFlags); packed struct POINT { int x; int y; } packed struct SIZE { LONG cx; LONG cy; } packed struct MSG { HWND hwnd; uint message; uint wParam; uint lParam; uint time; POINT pt; } [extern "user32.dll"] int SendMessageA (HWND hwnd, uint message, uint wparam, int lparam); [extern "user32.dll"] int SendMessageW (HWND hwnd, uint message, uint wparam, int lparam); int SendMessagePtrA (HWND hwnd, uint message, uint wparam, char* lparam); int SendMessagePtrW (HWND hwnd, uint message, uint wparam, wchar* lparam); [extern "user32.dll"] int PostMessageA (HWND hwnd, uint message, uint wparam, int lparam); [extern "user32.dll"] int PostMessageW (HWND hwnd, uint message, uint wparam, int lparam); [extern "user32.dll"] int GetMessageA (MSG* msg, HWND hwnd, uint min, int max); [extern "user32.dll"] int GetMessageW (MSG* msg, HWND hwnd, uint min, int max); [extern "user32.dll"] int PeekMessageA (MSG* msg, HWND hwnd, uint min, uint max, uint remove); [extern "user32.dll"] int PeekMessageW (MSG* msg, HWND hwnd, uint min, uint max, uint remove); const uint PM_NOREMOVE = 0; const uint PM_REMOVE = 1; const uint PM_NOYIELD = 2; [extern "user32.dll"] BOOL TranslateMessage (MSG* msg); [extern "user32.dll"] void DispatchMessageA (MSG* msg); [extern "user32.dll"] void DispatchMessageW (MSG* msg); [extern "user32.dll"] BOOL DestroyWindow (HWND hwnd); [extern "user32.dll"] void PostQuitMessage (int exitcode); [extern "user32.dll"] BOOL PostThreadMessageA (uint thread_id, uint message, uint wparam, int lparam); [extern "user32.dll"] BOOL PostThreadMessageW (uint thread_id, uint message, uint wparam, int lparam); const uint WM_CREATE = 0x0001; const uint WM_DESTROY = 0x0002; const uint WM_MOVE = 0x0003; const uint WM_SIZE = 0x0005; const uint WM_ACTIVATE = 0x0006; const uint WM_SETFOCUS = 0x0007; const uint WM_KILLFOCUS = 0x0008; const uint WM_ENABLE = 0x000A; const uint WM_SETREDRAW = 0x000B; const uint WM_SETTEXT = 0x000C; const uint WM_GETTEXT = 0x000D; const uint WM_GETTEXTLENGTH = 0x000E; const uint WM_PAINT = 0x000F; const uint WM_CLOSE = 0x0010; const uint WM_QUERYENDSESSION = 0x0011; const uint WM_QUIT = 0x0012; const uint WM_QUERYOPEN = 0x0013; const uint WM_ERASEBKGND = 0x0014; const uint WM_SYSCOLORCHANGE = 0x0015; const uint WM_ENDSESSION = 0x0016; const uint WM_SHOWWINDOW = 0x0018; const uint WM_WININICHANGE = 0x001A; const uint WM_DEVMODECHANGE = 0x001B; const uint WM_ACTIVATEAPP = 0x001C; const uint WM_FONTCHANGE = 0x001D; const uint WM_TIMECHANGE = 0x001E; const uint WM_CANCELMODE = 0x001F; const uint WM_SETCURSOR = 0x0020; const uint WM_MOUSEACTIVATE = 0x0021; const uint WM_CHILDACTIVATE = 0x0022; const uint WM_QUEUESYNC = 0x0023; const uint WM_GETMINMAXINFO = 0x0024; const uint WM_PAINTICON = 0x0026; const uint WM_ICONERASEBKGND = 0x0027; const uint WM_NEXTDLGCTL = 0x0028; const uint WM_SPOOLERSTATUS = 0x002A; const uint WM_DRAWITEM = 0x002B; const uint WM_MEASUREITEM = 0x002C; const uint WM_DELETEITEM = 0x002D; const uint WM_VKEYTOITEM = 0x002E; const uint WM_CHARTOITEM = 0x002F; const uint WM_SETFONT = 0x0030; const uint WM_GETFONT = 0x0031; const uint WM_SETHOTKEY = 0x0032; const uint WM_GETHOTKEY = 0x0033; const uint WM_QUERYDRAGICON = 0x0037; const uint WM_COMPAREITEM = 0x0039; const uint WM_GETOBJECT = 0x003D; const uint WM_COMPACTING = 0x0041; const uint WM_COMMNOTIFY = 0x0044; const uint WM_WINDOWPOSCHANGING = 0x0046; const uint WM_WINDOWPOSCHANGED = 0x0047; const uint WM_POWER = 0x0048; const uint WM_COPYDATA = 0x004A; const uint WM_CANCELJOURNAL = 0x004B; const uint WM_NOTIFY = 0x004E; const uint WM_INPUTLANGCHANGEREQUEST = 0x0050; const uint WM_INPUTLANGCHANGE = 0x0051; const uint WM_TCARD = 0x0052; const uint WM_HELP = 0x0053; const uint WM_USERCHANGED = 0x0054; const uint WM_NOTIFYFORMAT = 0x0055; const uint WM_CONTEXTMENU = 0x007B; const uint WM_STYLECHANGING = 0x007C; const uint WM_STYLECHANGED = 0x007D; const uint WM_DISPLAYCHANGE = 0x007E; const uint WM_GETICON = 0x007F; const uint WM_SETICON = 0x0080; const uint WM_NCCREATE = 0x0081; const uint WM_NCDESTROY = 0x0082; const uint WM_NCCALCSIZE = 0x0083; const uint WM_NCHITTEST = 0x0084; const uint WM_NCPAINT = 0x0085; const uint WM_NCACTIVATE = 0x0086; const uint WM_GETDLGCODE = 0x0087; const uint WM_SYNCPAINT = 0x0088; const uint WM_NCMOUSEMOVE = 0x00A0; const uint WM_NCLBUTTONDOWN = 0x00A1; const uint WM_NCLBUTTONUP = 0x00A2; const uint WM_NCLBUTTONDBLCLK = 0x00A3; const uint WM_NCRBUTTONDOWN = 0x00A4; const uint WM_NCRBUTTONUP = 0x00A5; const uint WM_NCRBUTTONDBLCLK = 0x00A6; const uint WM_NCMBUTTONDOWN = 0x00A7; const uint WM_NCMBUTTONUP = 0x00A8; const uint WM_NCMBUTTONDBLCLK = 0x00A9; const uint WM_KEYFIRST = 0x0100; const uint WM_KEYDOWN = 0x0100; const uint WM_KEYUP = 0x0101; const uint WM_CHAR = 0x0102; const uint WM_DEADCHAR = 0x0103; const uint WM_SYSKEYDOWN = 0x0104; const uint WM_SYSKEYUP = 0x0105; const uint WM_SYSCHAR = 0x0106; const uint WM_SYSDEADCHAR = 0x0107; const uint WM_KEYLAST = 0x0108; const uint WM_IME_STARTCOMPOSITION = 0x010D; const uint WM_IME_ENDCOMPOSITION = 0x010E; const uint WM_IME_COMPOSITION = 0x010F; const uint WM_IME_KEYLAST = 0x010F; const uint WM_INITDIALOG = 0x0110; const uint WM_COMMAND = 0x0111; const uint WM_SYSCOMMAND = 0x0112; const uint WM_TIMER = 0x0113; const uint WM_HSCROLL = 0x0114; const uint WM_VSCROLL = 0x0115; const uint WM_INITMENU = 0x0116; const uint WM_INITMENUPOPUP = 0x0117; const uint WM_MENUSELECT = 0x011F; const uint WM_MENUCHAR = 0x0120; const uint WM_ENTERIDLE = 0x0121; const uint WM_MENURBUTTONUP = 0x0122; const uint WM_MENUDRAG = 0x0123; const uint WM_MENUGETOBJECT = 0x0124; const uint WM_UNINITMENUPOPUP = 0x0125; const uint WM_MENUCOMMAND = 0x0126; const uint WM_CHANGEUISTATE = 0x0127; const uint WM_CTLCOLORMSGBOX = 0x0132; const uint WM_CTLCOLOREDIT = 0x0133; const uint WM_CTLCOLORLISTBOX = 0x0134; const uint WM_CTLCOLORBTN = 0x0135; const uint WM_CTLCOLORDLG = 0x0136; const uint WM_CTLCOLORSCROLLBAR = 0x0137; const uint WM_CTLCOLORSTATIC = 0x0138; const uint WM_MOUSEFIRST = 0x0200; const uint WM_MOUSEMOVE = 0x0200; const uint WM_LBUTTONDOWN = 0x0201; const uint WM_LBUTTONUP = 0x0202; const uint WM_LBUTTONDBLCLK = 0x0203; const uint WM_RBUTTONDOWN = 0x0204; const uint WM_RBUTTONUP = 0x0205; const uint WM_RBUTTONDBLCLK = 0x0206; const uint WM_MBUTTONDOWN = 0x0207; const uint WM_MBUTTONUP = 0x0208; const uint WM_MBUTTONDBLCLK = 0x0209; const uint WM_MOUSEWHEEL = 0x020A; const uint WM_PARENTNOTIFY = 0x0210; const uint WM_ENTERMENULOOP = 0x0211; const uint WM_EXITMENULOOP = 0x0212; const uint WM_NEXTMENU = 0x0213; const uint WM_SIZING = 0x0214; const uint WM_CAPTURECHANGED = 0x0215; const uint WM_MOVING = 0x0216; const uint WM_POWERBROADCAST = 0x0218; const uint WM_DEVICECHANGE = 0x0219; const uint WM_MDICREATE = 0x0220; const uint WM_MDIDESTROY = 0x0221; const uint WM_MDIACTIVATE = 0x0222; const uint WM_MDIRESTORE = 0x0223; const uint WM_MDINEXT = 0x0224; const uint WM_MDIMAXIMIZE = 0x0225; const uint WM_MDITILE = 0x0226; const uint WM_MDICASCADE = 0x0227; const uint WM_MDIICONARRANGE = 0x0228; const uint WM_MDIGETACTIVE = 0x0229; const uint WM_MDISETMENU = 0x0230; const uint WM_ENTERSIZEMOVE = 0x0231; const uint WM_EXITSIZEMOVE = 0x0232; const uint WM_DROPFILES = 0x0233; const uint WM_MDIREFRESHMENU = 0x0234; const uint WM_IME_SETCONTEXT = 0x0281; const uint WM_IME_NOTIFY = 0x0282; const uint WM_IME_CONTROL = 0x0283; const uint WM_IME_COMPOSITIONFULL = 0x0284; const uint WM_IME_SELECT = 0x0285; const uint WM_IME_CHAR = 0x0286; const uint WM_IME_REQUEST = 0x0288; const uint WM_IME_KEYDOWN = 0x0290; const uint WM_IME_KEYUP = 0x0291; const uint WM_MOUSEHOVER = 0x02A1; const uint WM_MOUSELEAVE = 0x02A3; const uint WM_CUT = 0x0300; const uint WM_COPY = 0x0301; const uint WM_PASTE = 0x0302; const uint WM_CLEAR = 0x0303; const uint WM_UNDO = 0x0304; const uint WM_RENDERFORMAT = 0x0305; const uint WM_RENDERALLFORMATS = 0x0306; const uint WM_DESTROYCLIPBOARD = 0x0307; const uint WM_DRAWCLIPBOARD = 0x0308; const uint WM_PAINTCLIPBOARD = 0x0309; const uint WM_VSCROLLCLIPBOARD = 0x030A; const uint WM_SIZECLIPBOARD = 0x030B; const uint WM_ASKCBFORMATNAME = 0x030C; const uint WM_CHANGECBCHAIN = 0x030D; const uint WM_HSCROLLCLIPBOARD = 0x030E; const uint WM_QUERYNEWPALETTE = 0x030F; const uint WM_PALETTEISCHANGING = 0x0310; const uint WM_PALETTECHANGED = 0x0311; const uint WM_HOTKEY = 0x0312; const uint WM_PRINT = 0x0317; const uint WM_PRINTCLIENT = 0x0318; const uint WM_HANDHELDFIRST = 0x0358; const uint WM_HANDHELDLAST = 0x035F; const uint WM_AFXFIRST = 0x0360; const uint WM_AFXLAST = 0x037F; const uint WM_PENWINFIRST = 0x0380; const uint WM_PENWINLAST = 0x038F; const uint WM_USER = 0x0400; const int HTERROR = (-2); const int HTTRANSPARENT = (-1); const int HTNOWHERE = 0; const int HTCLIENT = 1; const int HTCAPTION = 2; const int HTSYSMENU = 3; const int HTGROWBOX = 4; const int HTSIZE = HTGROWBOX; const int HTMENU = 5; const int HTHSCROLL = 6; const int HTVSCROLL = 7; const int HTMINBUTTON = 8; const int HTMAXBUTTON = 9; const int HTLEFT = 10; const int HTRIGHT = 11; const int HTTOP = 12; const int HTTOPLEFT = 13; const int HTTOPRIGHT = 14; const int HTBOTTOM = 15; const int HTBOTTOMLEFT = 16; const int HTBOTTOMRIGHT = 17; const int HTBORDER = 18; const int HTREDUCE = HTMINBUTTON; const int HTZOOM = HTMAXBUTTON; const int HTSIZEFIRST = HTLEFT; const int HTSIZELAST = HTBOTTOMRIGHT; const int HTOBJECT = 19; const int HTCLOSE = 20; const int HTHELP = 21; packed struct MINMAXINFO { POINT ptReserved; POINT ptMaxSize; POINT ptMaxPosition; POINT ptMinTrackSize; POINT ptMaxTrackSize; } struct PAINTSTRUCT { uint hdc; BOOL fErase; RECT rcPaint; BOOL fRestore; BOOL fIncUpdate; byte rgbReserved[32]; } [extern "user32.dll"] HDC BeginPaint (HWND hWnd, PAINTSTRUCT* lpPaint); [extern "user32.dll"] BOOL EndPaint (HWND hWnd, PAINTSTRUCT lpPaint); [extern "user32.dll"] BOOL InvalidateRect (HWND hWnd, RECT* rect, BOOL bErase); [extern "user32.dll"] BOOL UpdateWindow (HWND hWnd); [extern "user32.dll"] BOOL MoveWindow (HWND hWnd, int x, int y, int nWidth, int nHeight, BOOL brepaint); [extern "user32.dll"] BOOL SetWindowPos (HWND hWnd, HWND hWndInsertAfter, int X, int Y, int cx, int cy, UINT uFlags); const uint SWP_NOSIZE = 0x0001; const uint SWP_NOMOVE = 0x0002; const uint SWP_NOZORDER = 0x0004; const uint SWP_NOREDRAW = 0x0008; const uint SWP_NOACTIVATE = 0x0010; const uint SWP_FRAMECHANGED = 0x0020; const uint SWP_SHOWWINDOW = 0x0040; const uint SWP_HIDEWINDOW = 0x0080; const uint SWP_NOCOPYBITS = 0x0100; const uint SWP_NOOWNERZORDER = 0x0200; /* Don't do owner Z ordering */ const uint SWP_NOSENDCHANGING = 0x0400; /* Don't send WM_WINDOWPOSCHANGING */ const uint SWP_DRAWFRAME = SWP_FRAMECHANGED; const uint SWP_NOREPOSITION = SWP_NOOWNERZORDER; const uint SWP_DEFERERASE = 0x2000; const uint SWP_ASYNCWINDOWPOS = 0x4000; const uint HWND_TOP = 0; const uint HWND_BOTTOM = 1; const uint HWND_TOPMOST = HWND'max; const uint HWND_NOTOPMOST = HWND'max-1; packed struct WINDOWPOS { HWND hwnd; HWND hwndInsertAfter; int x; int y; int cx; int cy; UINT flags; } [extern "user32.dll"] BOOL SetWindowTextA (HWND hWnd, char *title); [extern "user32.dll"] BOOL SetWindowTextW (HWND hWnd, char *title); [extern "user32.dll"] int GetWindowTextA (HWND hWnd, char *lpString, uint nMaxCount); [extern "user32.dll"] int GetWindowTextW (HWND hWnd, wchar *lpString, uint nMaxCount); const uint SC_SIZE = 0xF000; const uint SC_MOVE = 0xF010; const uint SC_MINIMIZE = 0xF020; const uint SC_MAXIMIZE = 0xF030; const uint SC_NEXTWINDOW = 0xF040; const uint SC_PREVWINDOW = 0xF050; const uint SC_CLOSE = 0xF060; const uint SC_VSCROLL = 0xF070; const uint SC_HSCROLL = 0xF080; const uint SC_MOUSEMENU = 0xF090; const uint SC_KEYMENU = 0xF100; const uint SC_ARRANGE = 0xF110; const uint SC_RESTORE = 0xF120; const uint CS_VREDRAW = 0x0001; const uint CS_HREDRAW = 0x0002; const uint CS_DBLCLKS = 0x0008; const uint CS_OWNDC = 0x0020; const uint CS_CLASSDC = 0x0040; const uint CS_PARENTDC = 0x0080; const uint CS_NOCLOSE = 0x0200; const uint CS_SAVEBITS = 0x0800; const uint CS_BYTEALIGNCLIENT= 0x1000; const uint CS_BYTEALIGNWINDOW= 0x2000; const uint CS_GLOBALCLASS = 0x4000; const uint CS_IME = 0x10000; [extern "user32.dll"] BOOL IsIconic (HWND hWnd); [extern "user32.dll"] void GetWindowRect (HWND hWnd, RECT *r); [extern "user32.dll"] BOOL GetClientRect (HWND hWnd, RECT* lpRect); [extern "user32.dll"] uint SetClassLongA (HWND hwnd, int index, int dwNewLong); [extern "user32.dll"] uint SetClassLongW (HWND hwnd, int index, int dwNewLong); const int GCL_HCURSOR = (-12); [extern "user32.dll"] BOOL GetCursorPos (POINT* lpPoint); [extern "user32.dll"] BOOL SetCursorPos (int X, int Y); [extern "user32.dll"] BOOL CreateCaret (HWND hWnd, HBITMAP hBitmap, int nWidth, int nHeight); [extern "user32.dll"] BOOL SetCaretPos (int X, int Y); [extern "user32.dll"] BOOL ShowCaret (HWND hWnd); [extern "user32.dll"] BOOL HideCaret (HWND hWnd); [extern "user32.dll"] BOOL DestroyCaret (); [extern "user32.dll"] int GetSystemMetrics (int nIndex); const int SM_CXSCREEN = 0; const int SM_CYSCREEN = 1; const int SM_CXVSCROLL = 2; const int SM_CYHSCROLL = 3; const int SM_CYCAPTION = 4; const int SM_CXBORDER = 5; const int SM_CYBORDER = 6; const int SM_CXDLGFRAME = 7; const int SM_CYDLGFRAME = 8; const int SM_CYVTHUMB = 9; const int SM_CXHTHUMB = 10; const int SM_CXICON = 11; const int SM_CYICON = 12; const int SM_CXCURSOR = 13; const int SM_CYCURSOR = 14; const int SM_CYMENU = 15; const int SM_CXFULLSCREEN = 16; const int SM_CYFULLSCREEN = 17; const int SM_CYKANJIWINDOW = 18; const int SM_MOUSEPRESENT = 19; const int SM_CYVSCROLL = 20; const int SM_CXHSCROLL = 21; const int SM_DEBUG = 22; const int SM_SWAPBUTTON = 23; const int SM_RESERVED1 = 24; const int SM_RESERVED2 = 25; const int SM_RESERVED3 = 26; const int SM_RESERVED4 = 27; const int SM_CXMIN = 28; const int SM_CYMIN = 29; const int SM_CXSIZE = 30; const int SM_CYSIZE = 31; const int SM_CXFRAME = 32; const int SM_CYFRAME = 33; const int SM_CXMINTRACK = 34; const int SM_CYMINTRACK = 35; const int SM_CXDOUBLECLK = 36; const int SM_CYDOUBLECLK = 37; const int SM_CXICONSPACING = 38; const int SM_CYICONSPACING = 39; const int SM_MENUDROPALIGNMENT = 40; const int SM_PENWINDOWS = 41; const int SM_DBCSENABLED = 42; const int SM_CMOUSEBUTTONS = 43; const int SM_CXFIXEDFRAME = SM_CXDLGFRAME; const int SM_CYFIXEDFRAME = SM_CYDLGFRAME; const int SM_CXSIZEFRAME = SM_CXFRAME; const int SM_CYSIZEFRAME = SM_CYFRAME; const int SM_SECURE = 44; const int SM_CXEDGE = 45; const int SM_CYEDGE = 46; const int SM_CXMINSPACING = 47; const int SM_CYMINSPACING = 48; const int SM_CXSMICON = 49; const int SM_CYSMICON = 50; const int SM_CYSMCAPTION = 51; const int SM_CXSMSIZE = 52; const int SM_CYSMSIZE = 53; const int SM_CXMENUSIZE = 54; const int SM_CYMENUSIZE = 55; const int SM_ARRANGE = 56; const int SM_CXMINIMIZED = 57; const int SM_CYMINIMIZED = 58; const int SM_CXMAXTRACK = 59; const int SM_CYMAXTRACK = 60; const int SM_CXMAXIMIZED = 61; const int SM_CYMAXIMIZED = 62; const int SM_NETWORK = 63; const int SM_CLEANBOOT = 67; const int SM_CXDRAG = 68; const int SM_CYDRAG = 69; const int SM_SHOWSOUNDS = 70; const int SM_CXMENUCHECK = 71; const int SM_CYMENUCHECK = 72; const int SM_SLOWMACHINE = 73; const int SM_MIDEASTENABLED = 74; const int SM_MOUSEWHEELPRESENT = 75; const int SM_XVIRTUALSCREEN = 76; const int SM_YVIRTUALSCREEN = 77; const int SM_CXVIRTUALSCREEN = 78; const int SM_CYVIRTUALSCREEN = 79; const int SM_CMONITORS = 80; const int SM_SAMEDISPLAYFORMAT = 81; const int SM_CXPADDEDBORDER = 92; [extern "user32.dll"] int MessageBoxA (HWND hWnd, char *lpText, char *lpCaption, uint uType); [extern "user32.dll"] int MessageBoxW (HWND hWnd, wchar *lpText, wchar *lpCaption, uint uType); const uint MB_OK = 0; const uint MB_OKCANCEL = 0x00000001; const uint MB_ABORTRETRYIGNORE = 0x00000002; const uint MB_YESNOCANCEL = 0x00000003; const uint MB_YESNO = 0x00000004; const uint MB_RETRYCANCEL = 0x00000005; const uint MB_ICONHAND = 0x00000010; const uint MB_ICONQUESTION = 0x00000020; const uint MB_ICONEXCLAMATION = 0x00000030; const uint MB_ICONASTERISK = 0x00000040; const uint MB_USERICON = 0x00000080; const uint MB_ICONWARNING = MB_ICONEXCLAMATION; const uint MB_ICONERROR = MB_ICONHAND; const uint MB_ICONINFORMATION = MB_ICONASTERISK; const uint MB_ICONSTOP = MB_ICONHAND; [extern "user32.dll"] BOOL SystemParametersInfoA (uint uiAction, uint uiParam, byte* pvParam, uint fWinIni); [extern "user32.dll"] BOOL SystemParametersInfoW (uint uiAction, uint uiParam, byte* pvParam, uint fWinIni); const uint SPI_GETWORKAREA = 48; const UINT SIF_RANGE = 0x0001; const UINT SIF_PAGE = 0x0002; const UINT SIF_POS = 0x0004; const UINT SIF_DISABLENOSCROLL = 0x0008; const UINT SIF_TRACKPOS = 0x0010; const UINT SIF_ALL = (SIF_RANGE | SIF_PAGE | SIF_POS | SIF_TRACKPOS); const int SB_HORZ = 0; const int SB_VERT = 1; const int SB_CTL = 2; const int SB_BOTH = 3; const int SB_LINEUP = 0; const int SB_LINELEFT = 0; const int SB_LINEDOWN = 1; const int SB_LINERIGHT = 1; const int SB_PAGEUP = 2; const int SB_PAGELEFT = 2; const int SB_PAGEDOWN = 3; const int SB_PAGERIGHT = 3; const int SB_THUMBPOSITION = 4; const int SB_THUMBTRACK = 5; const int SB_TOP = 6; const int SB_LEFT = 6; const int SB_BOTTOM = 7; const int SB_RIGHT = 7; const int SB_ENDSCROLL = 8; struct SCROLLINFO { UINT cbSize; UINT fMask; int nMin; int nMax; UINT nPage; int nPos; int nTrackPos; } [extern "user32.dll"] int SetScrollInfo (HWND hwnd, int flag, SCROLLINFO *info, BOOL b); [extern "user32.dll"] BOOL GetScrollInfo (HWND hwnd, int flag, SCROLLINFO *info); const uint ES_LEFT = 0x0000; const uint ES_CENTER = 0x0001; const uint ES_RIGHT = 0x0002; const uint ES_MULTILINE = 0x0004; const uint ES_UPPERCASE = 0x0008; const uint ES_LOWERCASE = 0x0010; const uint ES_PASSWORD = 0x0020; const uint ES_AUTOVSCROLL = 0x0040; const uint ES_AUTOHSCROLL = 0x0080; const uint ES_NOHIDESEL = 0x0100; const uint ES_OEMCONVERT = 0x0400; const uint ES_READONLY = 0x0800; const uint ES_WANTRETURN = 0x1000; const uint ES_NUMBER = 0x2000; const uint EM_GETSEL = 0x00B0; const uint EM_SETSEL = 0x00B1; const uint EM_GETRECT = 0x00B2; const uint EM_SETRECT = 0x00B3; const uint EM_SETRECTNP = 0x00B4; const uint EM_SCROLL = 0x00B5; const uint EM_LINESCROLL = 0x00B6; const uint EM_SCROLLCARET = 0x00B7; const uint EM_GETMODIFY = 0x00B8; const uint EM_SETMODIFY = 0x00B9; const uint EM_GETLINECOUNT = 0x00BA; const uint EM_LINEINDEX = 0x00BB; const uint EM_SETHANDLE = 0x00BC; const uint EM_GETHANDLE = 0x00BD; const uint EM_GETTHUMB = 0x00BE; const uint EM_LINELENGTH = 0x00C1; const uint EM_REPLACESEL = 0x00C2; const uint EM_GETLINE = 0x00C4; const uint EM_LIMITTEXT = 0x00C5; const uint EM_CANUNDO = 0x00C6; const uint EM_UNDO = 0x00C7; const uint EM_FMTLINES = 0x00C8; const uint EM_LINEFROMCHAR = 0x00C9; const uint EM_SETTABSTOPS = 0x00CB; const uint EM_SETPASSWORDCHAR = 0x00CC; const uint EM_EMPTYUNDOBUFFER = 0x00CD; const uint EM_GETFIRSTVISIBLELINE = 0x00CE; const uint EM_SETREADONLY = 0x00CF; const uint EM_SETWORDBREAKPROC = 0x00D0; const uint EM_GETWORDBREAKPROC = 0x00D1; const uint EM_GETPASSWORDCHAR = 0x00D2; const uint EM_SETMARGINS = 0x00D3; const uint EM_GETMARGINS = 0x00D4; const uint EM_SETLIMITTEXT = EM_LIMITTEXT; const uint EM_GETLIMITTEXT = 0x00D5; const uint EM_POSFROMCHAR = 0x00D6; const uint EM_CHARFROMPOS = 0x00D7; const uint EM_SETIMESTATUS = 0x00D8; const uint EM_GETIMESTATUS = 0x00D9; const uint EM_SETBKGNDCOLOR = (WM_USER + 67); const uint EM_AUTOURLDETECT = (WM_USER + 91); const uint AURL_ENABLEEAURLS = 8; // VIRTUALKEYCODES const int VK_LBUTTON = 0x01; const int VK_RBUTTON = 0x02; const int VK_CANCEL = 0x03; const int VK_MBUTTON = 0x04; /* NOT contiguous with L & RBUTTON */ const int VK_BACK = 0x08; const int VK_TAB = 0x09; const int VK_CLEAR = 0x0C; const int VK_RETURN = 0x0D; const int VK_SHIFT = 0x10; const int VK_CONTROL = 0x11; const int VK_MENU = 0x12; const int VK_PAUSE = 0x13; const int VK_CAPITAL = 0x14; const int VK_KANA = 0x15; const int VK_JUNJA = 0x17; const int VK_FINAL = 0x18; const int VK_HANJA = 0x19; const int VK_KANJI = 0x19; const int VK_ESCAPE = 0x1B; const int VK_CONVERT = 0x1C; const int VK_NONCONVERT = 0x1D; const int VK_ACCEPT = 0x1E; const int VK_MODECHANGE = 0x1F; const int VK_SPACE = 0x20; const int VK_PRIOR = 0x21; const int VK_NEXT = 0x22; const int VK_END = 0x23; const int VK_HOME = 0x24; const int VK_LEFT = 0x25; const int VK_UP = 0x26; const int VK_RIGHT = 0x27; const int VK_DOWN = 0x28; const int VK_SELECT = 0x29; const int VK_PRINT = 0x2A; const int VK_EXECUTE = 0x2B; const int VK_SNAPSHOT = 0x2C; const int VK_INSERT = 0x2D; const int VK_DELETE = 0x2E; const int VK_HELP = 0x2F; const int VK_LWIN = 0x5B; const int VK_RWIN = 0x5C; const int VK_APPS = 0x5D; const int VK_NUMPAD0 = 0x60; const int VK_NUMPAD1 = 0x61; const int VK_NUMPAD2 = 0x62; const int VK_NUMPAD3 = 0x63; const int VK_NUMPAD4 = 0x64; const int VK_NUMPAD5 = 0x65; const int VK_NUMPAD6 = 0x66; const int VK_NUMPAD7 = 0x67; const int VK_NUMPAD8 = 0x68; const int VK_NUMPAD9 = 0x69; const int VK_MULTIPLY = 0x6A; const int VK_ADD = 0x6B; const int VK_SEPARATOR = 0x6C; const int VK_SUBTRACT = 0x6D; const int VK_DECIMAL = 0x6E; const int VK_DIVIDE = 0x6F; const int VK_F1 = 0x70; const int VK_F2 = 0x71; const int VK_F3 = 0x72; const int VK_F4 = 0x73; const int VK_F5 = 0x74; const int VK_F6 = 0x75; const int VK_F7 = 0x76; const int VK_F8 = 0x77; const int VK_F9 = 0x78; const int VK_F10 = 0x79; const int VK_F11 = 0x7A; const int VK_F12 = 0x7B; const int VK_F13 = 0x7C; const int VK_F14 = 0x7D; const int VK_F15 = 0x7E; const int VK_F16 = 0x7F; const int VK_F17 = 0x80; const int VK_F18 = 0x81; const int VK_F19 = 0x82; const int VK_F20 = 0x83; const int VK_F21 = 0x84; const int VK_F22 = 0x85; const int VK_F23 = 0x86; const int VK_F24 = 0x87; const int VK_NUMLOCK = 0x90; const int VK_SCROLL = 0x91; const int VK_LSHIFT = 0xA0; const int VK_RSHIFT = 0xA1; const int VK_LCONTROL = 0xA2; const int VK_RCONTROL = 0xA3; const int VK_LMENU = 0xA4; const int VK_RMENU = 0xA5; /* * Key State Masks for Mouse Messages */ const int MK_LBUTTON = 0x0001; const int MK_RBUTTON = 0x0002; const int MK_SHIFT = 0x0004; const int MK_CONTROL = 0x0008; const int MK_MBUTTON = 0x0010; const uint TME_HOVER = 0x00000001; const uint TME_LEAVE = 0x00000002; const uint TME_QUERY = 0x40000000; const uint TME_CANCEL = 0x80000000; packed struct TRACKMOUSEEVENT { DWORD cbSize; DWORD dwFlags; HWND hwndTrack; DWORD dwHoverTime; } [extern "user32.dll"] BOOL TrackMouseEvent (TRACKMOUSEEVENT EventTrack); [extern "user32.dll"] int FillRect (HDC hDC, RECT lprc, HBRUSH hbr); [extern "user32.dll"] HDC GetDC (HWND hWnd); [extern "user32.dll"] HDC GetDCEx (HWND hwnd, HRGN hrgn, uint flags); [extern "user32.dll"] int ReleaseDC (HWND hWnd, HDC hDC); [extern "user32.dll"] HDC GetWindowDC (HWND hwnd); const uint DCX_WINDOW = 0x00000001; const uint DCX_CACHE = 0x00000002; const uint DCX_NORESETATTRS = 0x00000004; const uint DCX_CLIPCHILDREN = 0x00000008; const uint DCX_CLIPSIBLINGS = 0x00000010; const uint DCX_PARENTCLIP = 0x00000020; const uint DCX_EXCLUDERGN = 0x00000040; const uint DCX_INTERSECTRGN = 0x00000080; const uint DCX_EXCLUDEUPDATE = 0x00000100; const uint DCX_INTERSECTUPDATE= 0x00000200; const uint DCX_LOCKWINDOWUPDATE= 0x00000400; const uint DCX_VALIDATE = 0x00200000; //------------------------------------------------------------------------------ [extern "gdi32.dll"] BOOL GetTextExtentPoint32A (HDC hdc, char *lpString, int c, SIZE* lpSize); [extern "gdi32.dll"] BOOL GetTextExtentPoint32W (HDC hdc, wchar *lpString, int c, SIZE* lpSize); [extern "gdi32.dll"] int ExcludeClipRect (HDC hdc, int nLeftRect, int nTopRect, int nRightRect, int nBottomRect); const int NULLREGION = 1; [extern "gdi32.dll"] HGDIOBJ SelectObject (HDC hdc, HGDIOBJ hgdiobj); [extern "gdi32.dll"] BOOL DeleteObject (HGDIOBJ hObject); [extern "gdi32.dll"] BOOL DeleteDC (HDC hdc); [extern "gdi32.dll"] HBITMAP CreateCompatibleBitmap (HDC hdc, int nWidth, int nHeight); [extern "gdi32.dll"] HDC CreateCompatibleDC (HDC hdc); [extern "gdi32.dll"] BOOL SetPixelV (HDC hdc, int X, int Y, COLORREF crColor); [extern "gdi32.dll"] HPEN CreatePen (int fnPenStyle, int nWidth, COLORREF crColor); [extern "gdi32.dll"] BOOL Polyline (HDC hdc, POINT *lppt, int cPoints); [extern "gdi32.dll"] HBRUSH CreateSolidBrush (COLORREF crColor); [extern "gdi32.dll"] COLORREF SetTextColor (HDC hdc, COLORREF crColor); [extern "gdi32.dll"] COLORREF SetBkColor (HDC hdc, COLORREF crColor); [extern "gdi32.dll"] int SetBkMode (HDC hdc, int iBkMode); const int TRANSPARENT = 1; const int OPAQUE = 2; [extern "gdi32.dll"] HFONT CreateFontA ( int nHeight, int nWidth, int nEscapement, int nOrientation, int fnWeight, BOOL fdwItalic, BOOL fdwUnderline, BOOL fdwStrikeOut, DWORD fdwCharSet, DWORD fdwOutputPrecision, DWORD fdwClipPrecision, DWORD fdwQuality, DWORD fdwPitchAndFamily, char *lpszFace); [extern "gdi32.dll"] HFONT CreateFontW ( int nHeight, int nWidth, int nEscapement, int nOrientation, int fnWeight, BOOL fdwItalic, BOOL fdwUnderline, BOOL fdwStrikeOut, DWORD fdwCharSet, DWORD fdwOutputPrecision, DWORD fdwClipPrecision, DWORD fdwQuality, DWORD fdwPitchAndFamily, wchar *lpszFace); const int FW_BOLD = 700; const int FW_DONTCARE = 0; const uint ANSI_CHARSET = 0; const uint OUT_DEFAULT_PRECIS = 0; const uint CLIP_DEFAULT_PRECIS = 0; const uint DRAFT_QUALITY = 1; const uint DEFAULT_PITCH = 0; [extern "gdi32.dll"] void Rectangle (HDC hdc, int left, int top, int right, int bottom); [extern "gdi32.dll"] BOOL TextOutA (HDC hdc, int nXStart, int nYStart, LPCSTR lpString, int cchString); [extern "gdi32.dll"] BOOL TextOutW (HDC hdc, int nXStart, int nYStart, LPCWSTR lpString, int cchString); [extern "gdi32.dll"] BOOL ExtTextOutA (HDC hdc, int X, int Y, UINT fuOptions, RECT* lprc, LPCSTR lpString, UINT cbCount, INT *lpDx); [extern "gdi32.dll"] BOOL ExtTextOutW (HDC hdc, int X, int Y, UINT fuOptions, RECT* lprc, LPCWSTR lpString, UINT cbCount, INT *lpDx); const UINT ETO_CLIPPED = 0x0004; const UINT ETO_OPAQUE = 0x0002; [extern "gdi32.dll"] BOOL BitBlt (HDC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HDC hdcSrc, int nXSrc, int nYSrc, DWORD dwRop); const DWORD SRCCOPY = 0x00CC0020; const uint BI_RGB = 0; packed struct BITMAPINFOHEADER { DWORD biSize; LONG biWidth; LONG biHeight; WORD biPlanes; WORD biBitCount; DWORD biCompression; DWORD biSizeImage; LONG biXPelsPerMeter; LONG biYPelsPerMeter; DWORD biClrUsed; DWORD biClrImportant; } [extern "gdi32.dll"] HBITMAP CreateDIBSection (HDC hdc, byte *pbmi, UINT iUsage, byte **ppvBits, HANDLE hSection, DWORD dwOffset); const uint DIB_RGB_COLORS = 0; const int CTLCOLOR_MSGBOX = 0; const int CTLCOLOR_EDIT = 1; const int CTLCOLOR_LISTBOX = 2; const int CTLCOLOR_BTN = 3; const int CTLCOLOR_DLG = 4; const int CTLCOLOR_SCROLLBAR = 5; const int CTLCOLOR_STATIC = 6; const int CTLCOLOR_MAX = 7; const int COLOR_SCROLLBAR = 0; const int COLOR_BACKGROUND = 1; const int COLOR_ACTIVECAPTION = 2; const int COLOR_INACTIVECAPTION = 3; const int COLOR_MENU = 4; const int COLOR_WINDOW = 5; const int COLOR_WINDOWFRAME = 6; const int COLOR_MENUTEXT = 7; const int COLOR_WINDOWTEXT = 8; const int COLOR_CAPTIONTEXT = 9; const int COLOR_ACTIVEBORDER = 10; const int COLOR_INACTIVEBORDER = 11; const int COLOR_APPWORKSPACE = 12; const int COLOR_HIGHLIGHT = 13; const int COLOR_HIGHLIGHTTEXT = 14; const int COLOR_BTNFACE = 15; const int COLOR_BTNSHADOW = 16; const int COLOR_GRAYTEXT = 17; const int COLOR_BTNTEXT = 18; const int COLOR_INACTIVECAPTIONTEXT= 19; const int COLOR_BTNHIGHLIGHT = 20; const int COLOR_3DDKSHADOW = 21; const int COLOR_3DLIGHT = 22; const int COLOR_INFOTEXT = 23; const int COLOR_INFOBK = 24; const int COLOR_HOTLIGHT = 26; const int COLOR_GRADIENTACTIVECAPTION = 27; const int COLOR_GRADIENTINACTIVECAPTION = 28; const int COLOR_DESKTOP = COLOR_BACKGROUND; const int COLOR_3DFACE = COLOR_BTNFACE; const int COLOR_3DSHADOW = COLOR_BTNSHADOW; const int COLOR_3DHIGHLIGHT = COLOR_BTNHIGHLIGHT; const int COLOR_3DHILIGHT = COLOR_BTNHIGHLIGHT; const int COLOR_BTNHILIGHT = COLOR_BTNHIGHLIGHT; [extern "gdi32.dll"] HGDIOBJ GetStockObject (int n); const int WHITE_BRUSH = 0; const int LTGRAY_BRUSH = 1; const int GRAY_BRUSH = 2; const int DKGRAY_BRUSH = 3; const int BLACK_BRUSH = 4; const int NULL_BRUSH = 5; const int HOLLOW_BRUSH = NULL_BRUSH; const int WHITE_PEN = 6; const int BLACK_PEN = 7; const int NULL_PEN = 8; const int OEM_FIXED_FONT = 10; const int ANSI_FIXED_FONT = 11; const int ANSI_VAR_FONT = 12; const int SYSTEM_FONT = 13; const int DEVICE_DEFAULT_FONT= 14; const int DEFAULT_PALETTE = 15; const int SYSTEM_FIXED_FONT = 16; const int DEFAULT_GUI_FONT = 17; const int DC_BRUSH = 18; const int DC_PEN = 19; const int BS_SOLID = 0; const int BS_NULL = 1; const int BS_HOLLOW = BS_NULL; const int BS_HATCHED = 2; const int BS_PATTERN = 3; const int BS_INDEXED = 4; const int BS_DIBPATTERN = 5; const int BS_DIBPATTERNPT = 6; const int BS_PATTERN8X8 = 7; const int BS_DIBPATTERN8X8 = 8; const int BS_MONOPATTERN = 9; const int HS_HORIZONTAL = 0; const int HS_VERTICAL = 1; const int HS_FDIAGONAL = 2; const int HS_BDIAGONAL = 3; const int HS_CROSS = 4; const int HS_DIAGCROSS = 5; const int PS_SOLID = 0; const int PS_DASH = 1; const int PS_DOT = 2; const int PS_DASHDOT = 3; const int PS_DASHDOTDOT = 4; const int PS_NULL = 5; const int PS_INSIDEFRAME = 6; const int PS_USERSTYLE = 7; const int PS_ALTERNATE = 8; const int PS_STYLE_MASK = 0x0000000F; const int PS_ENDCAP_ROUND = 0x00000000; const int PS_ENDCAP_SQUARE = 0x00000100; const int PS_ENDCAP_FLAT = 0x00000200; const int PS_ENDCAP_MASK = 0x00000F00; const int PS_JOIN_ROUND = 0x00000000; const int PS_JOIN_BEVEL = 0x00001000; const int PS_JOIN_MITER = 0x00002000; const int PS_JOIN_MASK = 0x0000F000; const int PS_COSMETIC = 0x00000000; const int PS_GEOMETRIC = 0x00010000; const int PS_TYPE_MASK = 0x000F0000; [extern "Gdi32.dll"] int GetDeviceCaps (HDC hdc, int nIndex); const int HORZRES = 8; const int VERTRES = 10; const int PHYSICALOFFSETY = 113; const int PHYSICALOFFSETX = 112; const int PHYSICALHEIGHT = 111; const int PHYSICALWIDTH = 110; struct DEVMODE { char dmDeviceName[32]; WORD dmSpecVersion; WORD dmDriverVersion; WORD dmSize; WORD dmDriverExtra; DWORD dmFields; short dmOrientation; short dmPaperSize; short dmPaperLength; short dmPaperWidth; short dmScale; short dmCopies; short dmDefaultSource; short dmPrintQuality; short dmColor; short dmDuplex; short dmYResolution; short dmTTOption; short dmCollate; char dmFormName[32]; WORD dmLogPixels; DWORD dmBitsPerPel; DWORD dmPelsWidth; DWORD dmPelsHeight; DWORD dmDisplayFlags; DWORD dmDisplayFrequency; DWORD dmICMMethod; DWORD dmICMIntent; DWORD dmMediaType; DWORD dmDitherType; DWORD dmReserved1; DWORD dmReserved2; DWORD dmPanningWidth; DWORD dmPanningHeight; } struct DOCINFO { uint cbSize; LPCTSTR lpszDocName; LPCTSTR lpszOutput; LPCTSTR lpszDatatype; DWORD fwType; } typedef byte* LPPRINTHOOKPROC; typedef byte* LPSETUPHOOKPROC; struct PRINTDLG { DWORD lStructSize; HWND hwndOwner; HGLOBAL hDevMode; HGLOBAL hDevNames; HDC hDC; DWORD Flags; WORD nFromPage; WORD nToPage; WORD nMinPage; WORD nMaxPage; WORD nCopies; HINSTANCE hInstance; LPARAM lCustData; LPPRINTHOOKPROC lpfnPrintHook; LPSETUPHOOKPROC lpfnSetupHook; LPCTSTR lpPrintTemplateName; LPCTSTR lpSetupTemplateName; HGLOBAL hPrintTemplate; HGLOBAL hSetupTemplate; } const uint PD_RETURNDEFAULT = 0x00000400; const uint PD_RETURNDC = 0x00000100; const uint PD_NOWARNING = 0x00000080; [extern "Comdlg32.dll"] BOOL PrintDlgA (ref PRINTDLG lppd); typedef byte* LPPRINTER_DEFAULTS; typedef LPSTR LPTSTR; typedef DEVMODE* LPDEVMODE; typedef byte* PSECURITY_DESCRIPTOR; typedef BYTE* LPBYTE; typedef DWORD* LPDWORD; typedef CHAR TCHAR; typedef BYTE VOID; [extern "winspool.drv"] BOOL GetDefaultPrinterA (LPTSTR pszBuffer, LPDWORD pcchBuffer); [extern "Winspool.drv"] BOOL OpenPrinterA (LPTSTR pPrinterName, HANDLE* phPrinter, LPPRINTER_DEFAULTS pDefault); struct PRINTER_INFO_2 { LPTSTR pServerName; LPTSTR pPrinterName; LPTSTR pShareName; LPTSTR pPortName; LPTSTR pDriverName; LPTSTR pComment; LPTSTR pLocation; LPDEVMODE pDevMode; LPTSTR pSepFile; LPTSTR pPrintProcessor; LPTSTR pDatatype; LPTSTR pParameters; PSECURITY_DESCRIPTOR pSecurityDescriptor; DWORD Attributes; DWORD Priority; DWORD DefaultPriority; DWORD StartTime; DWORD UntilTime; DWORD Status; DWORD cJobs; DWORD AveragePPM; } const int SP_ERROR = -1; const uint DM_TTOPTION = 0x00004000; const short DMTT_BITMAP = 1; // force mode bitmap [extern "Winspool.drv"] BOOL GetPrinterA (HANDLE hPrinter, DWORD Level, LPBYTE pPrinter, DWORD cbBuf, LPDWORD pcbNeeded); [extern "Spoolss.dll"] BOOL ClosePrinter (HANDLE hPrinter); [extern "Gdi32.dll"] int StartDocA (HDC hdc, DOCINFO *lpdi); [extern "Gdi32.dll"] int AbortDoc (HDC hdc); [extern "Gdi32.dll"] int EndDoc (HDC hdc); [extern "Gdi32.dll"] int StartPage (HDC hDC); [extern "Gdi32.dll"] int EndPage (HDC hDC); [extern "Gdi32.dll"] HDC ResetDCA (HDC hdc, DEVMODE *lpInitData); [extern "Gdi32.dll"] HDC CreateDCA (LPCTSTR lpszDriver, LPCTSTR lpszDevice, LPCTSTR lpszOutput, DEVMODE* lpInitData); const int LF_FACESIZE = 32; const int LF_FULLFACESIZE = 64; struct LOGFONT { LONG lfHeight; LONG lfWidth; LONG lfEscapement; LONG lfOrientation; LONG lfWeight; BYTE lfItalic; BYTE lfUnderline; BYTE lfStrikeOut; BYTE lfCharSet; BYTE lfOutPrecision; BYTE lfClipPrecision; BYTE lfQuality; BYTE lfPitchAndFamily; TCHAR lfFaceName[LF_FACESIZE]; } struct ENUMLOGFONT { LOGFONT elfLogFont; TCHAR elfFullName[LF_FULLFACESIZE]; TCHAR elfStyle[LF_FACESIZE]; } struct NEWTEXTMETRIC { LONG tmHeight; LONG tmAscent; LONG tmDescent; LONG tmInternalLeading; LONG tmExternalLeading; LONG tmAveCharWidth; LONG tmMaxCharWidth; LONG tmWeight; LONG tmOverhang; LONG tmDigitizedAspectX; LONG tmDigitizedAspectY; TCHAR tmFirstChar; TCHAR tmLastChar; TCHAR tmDefaultChar; TCHAR tmBreakChar; BYTE tmItalic; BYTE tmUnderlined; BYTE tmStruckOut; BYTE tmPitchAndFamily; BYTE tmCharSet; DWORD ntmFlags; UINT ntmSizeEM; UINT ntmCellHeight; UINT ntmAvgWidth; } packed struct RGBQUAD { BYTE rgbBlue; BYTE rgbGreen; BYTE rgbRed; BYTE rgbReserved; } struct BITMAPINFO { BITMAPINFOHEADER bmiHeader; RGBQUAD bmiColors[1]; } typedef [callback] int FONTENUMPROC (ENUMLOGFONT *lpelf, NEWTEXTMETRIC *lpntm, DWORD FontType, LPARAM lParam); [extern "Gdi32.dll"] int EnumFontFamilies (HDC hdc, LPCTSTR lpszFamily, FONTENUMPROC lpEnumFontFamProc, LPARAM lParam); [extern "Gdi32.dll"] int StretchDIBits (HDC hdc, int XDest, int YDest, int nDestWidth, int nDestHeight, int XSrc, int YSrc, int nSrcWidth, int nSrcHeight, VOID *lpBits, BITMAPINFO *lpBitsInfo, UINT iUsage, DWORD dwRop); const uint FF_MODERN = (3<<4); const uint DM_COLOR = 0x00000800; const short DMCOLOR_COLOR = 2; const int GDI_ERROR = -1; //------------------------------------------------------------------------------ [extern "user32.dll"] UINT_PTR SetTimer(HWND hWnd, UINT_PTR nIDEvent, UINT uElapse, TIMERPROC lpTimerFunc); [extern "user32.dll"] BOOL KillTimer (HWND hWnd, UINT_PTR uIDEvent); [extern "user32.dll"] SHORT GetKeyState (int nVirtKey); [extern "user32.dll"] LONG GetDialogBaseUnits(); [extern "user32.dll"] HWND GetWindow (HWND hWnd, UINT uCmd); const uint GW_HWNDFIRST = 0; const uint GW_HWNDLAST = 1; const uint GW_HWNDNEXT = 2; const uint GW_HWNDPREV = 3; const uint GW_OWNER = 4; const uint GW_CHILD = 5; const uint GW_ENABLEDPOPUP = 6; packed struct LOGBRUSH { UINT lbStyle; COLORREF lbColor; ULONG lbHatch; } [extern "gdi32.dll"] HBRUSH CreateBrushIndirect(LOGBRUSH *lplb); //------------------------------------------------------------------------------ [extern "user32.dll"] BOOL OpenClipboard (HWND hWndNewOwner); [extern "user32.dll"] BOOL EmptyClipboard (); [extern "user32.dll"] HANDLE GetClipboardData (UINT uFormat); [extern "user32.dll"] HANDLE SetClipboardData (UINT uFormat, HANDLE hMem); [extern "user32.dll"] BOOL CloseClipboard (); //------------------------------------------------------------------------------ struct NOTIFYICONDATA { DWORD cbSize; HWND hWnd; UINT uID; UINT uFlags; UINT uCallbackMessage; HICON hIcon; char szTip[64]; DWORD dwState; DWORD dwStateMask; char szInfo[256]; UINT uTimeout; char szInfoTitle[64]; DWORD dwInfoFlags; byte[16] guidItem; HICON hBalloonIcon; } const uint NIF_MESSAGE = 0x00000001; const uint NIF_ICON = 0x00000002; const uint NIF_TIP = 0x00000004; [extern "shell32.dll"] int Shell_NotifyIconA (int dwMessage, NOTIFYICONDATA lpdata); const int NIM_ADD = 0x00000000; const int NIM_DELETE = 0x00000002; [extern "user32.dll"] uint RegisterWindowMessageA (char* lpString); //------------------------------------------------------------------------------ [extern "kernel32.dll"] HGLOBAL GlobalAlloc (UINT uFlags, SIZE_T dwBytes); const UINT GMEM_MOVEABLE = 0x0002; [extern "kernel32.dll"] HGLOBAL GlobalFree (HGLOBAL hMem); [extern "kernel32.dll"] byte* GlobalLock (HGLOBAL hMem); [extern "kernel32.dll"] SIZE_T GlobalSize (HGLOBAL hMem); [extern "kernel32.dll"] BOOL GlobalUnlock (HGLOBAL hMem); [extern "kernel32.dll"] void ExitProcess (uint retcode); [extern "kernel32.dll"] HWND CreateEventA (byte *lpEventAttributes, BOOL bManualReset, BOOL bInitialState, char *lpName); [extern "kernel32.dll"] BOOL SetEvent (HANDLE hEvent); [extern "kernel32.dll"] DWORD WaitForSingleObject (HANDLE hHandle, DWORD dwMilliseconds); const DWORD WAIT_TIMEOUT = 0x00000102; const DWORD WAIT_FAILED = 0xFFFFFFFF; const DWORD WAIT_ABANDONED = 0x00000080; // thread was killed [extern "kernel32.dll"] uint GetTickCount (); [extern "kernel32.dll"] HRSRC FindResourceA (HMODULE hModule, uint lpName, uint lpType); [extern "kernel32.dll"] HGLOBAL LoadResource (HMODULE hModule, HRSRC hResInfo); [extern "kernel32.dll"] LPVOID LockResource(HGLOBAL hResData); [extern "kernel32.dll"] DWORD SizeofResource (HMODULE hModule, HRSRC hResInfo); uint RGB (uint r, uint g, uint b); [extern "user32.dll"] HMENU LoadMenuA (HINSTANCE hInstance, LPCSTR lpMenuName); [extern "user32.dll"] HMENU LoadMenuW (HINSTANCE hInstance, LPCWSTR lpMenuName); [extern "user32.dll"] HMENU LoadMenuIndirectA (MENUTEMPLATEA *lpMenuTemplate); [extern "user32.dll"] HMENU LoadMenuIndirectW (MENUTEMPLATEW *lpMenuTemplate); [extern "user32.dll"] HMENU GetMenu (HWND hWnd); [extern "user32.dll"] BOOL SetMenu (HWND hWnd, HMENU hMenu); [extern "user32.dll"] BOOL ChangeMenuA (HMENU hMenu, UINT cmd, LPCSTR lpszNewItem, UINT cmdInsert, UINT flags); [extern "user32.dll"] BOOL ChangeMenuW (HMENU hMenu, UINT cmd, LPCWSTR lpszNewItem, UINT cmdInsert, UINT flags); [extern "user32.dll"] BOOL HiliteMenuItem (HWND hWnd, HMENU hMenu, UINT uIDHiliteItem, UINT uHilite); [extern "user32.dll"] int GetMenuStringA (HMENU hMenu, UINT uIDItem, LPSTR lpString, int nMaxCount, UINT uFlag); [extern "user32.dll"] int GetMenuStringW (HMENU hMenu, UINT uIDItem, LPWSTR lpString, int nMaxCount, UINT uFlag); [extern "user32.dll"] UINT GetMenuState (HMENU hMenu, UINT uId, UINT uFlags); [extern "user32.dll"] BOOL DrawMenuBar (HWND hWnd); [extern "user32.dll"] HMENU GetSystemMenu(HWND hWnd, BOOL bRevert); [extern "user32.dll"] HMENU CreateMenu (); [extern "user32.dll"] HMENU CreatePopupMenu(); [extern "user32.dll"] BOOL DestroyMenu (HMENU hMenu); [extern "user32.dll"] DWORD CheckMenuItem (HMENU hMenu, UINT uIDCheckItem, UINT uCheck); [extern "user32.dll"] BOOL EnableMenuItem (HMENU hMenu, UINT uIDEnableItem, UINT uEnable); [extern "user32.dll"] HMENU GetSubMenu (HMENU hMenu, int nPos); [extern "user32.dll"] UINT GetMenuItemID (HMENU hMenu, int nPos); [extern "user32.dll"] int GetMenuItemCount (HMENU hMenu); [extern "user32.dll"] BOOL InsertMenuA (HMENU hMenu, UINT uPosition, UINT uFlags, UINT uIDNewItem, LPCSTR lpNewItem); [extern "user32.dll"] BOOL InsertMenuW (HMENU hMenu, UINT uPosition, UINT uFlags, UINT uIDNewItem, LPCWSTR lpNewItem); [extern "user32.dll"] BOOL AppendMenuA (HMENU hMenu, UINT uFlags, UINT uIDNewItem, LPCSTR lpNewItem); [extern "user32.dll"] BOOL AppendMenuW (HMENU hMenu, UINT uFlags, UINT uIDNewItem, LPCWSTR lpNewItem); [extern "user32.dll"] BOOL ModifyMenuA (HMENU hMenu, UINT uPosition, UINT uFlags, UINT uIDNewItem, LPCSTR lpNewItem); [extern "user32.dll"] BOOL ModifyMenuW (HMENU hMnu, UINT uPosition, UINT uFlags, UINT uIDNewItem, LPCWSTR lpNewItem); [extern "user32.dll"] BOOL RemoveMenu (HMENU hMenu, UINT uPosition, UINT uFlags); [extern "user32.dll"] BOOL DeleteMenu (HMENU hMenu, UINT uPosition, UINT uFlags); [extern "user32.dll"] BOOL SetMenuItemBitmaps (HMENU hMenu, UINT uPosition, UINT uFlags, HBITMAP hBitmapUnchecked, HBITMAP hBitmapChecked); [extern "user32.dll"] LONG GetMenuCheckMarkDimensions (); [extern "user32.dll"] BOOL TrackPopupMenu(HMENU hMenu, UINT uFlags, int x, int y, int nReserved, HWND hWnd, RECT *prcRect); const int MNC_IGNORE =0; const int MNC_CLOSE =1; const int MNC_EXECUTE =2; const int MNC_SELECT =3; struct TPMPARAMS { UINT cbSize; RECT rcExclude; } typedef TPMPARAMS *LPTPMPARAMS; [extern "user32.dll"] BOOL TrackPopupMenuEx (HMENU hmenu, UINT m, int a, int b, HWND h, LPTPMPARAMS p); const uint MNS_NOCHECK = 0x80000000; const uint MNS_MODELESS = 0x40000000; const uint MNS_DRAGDROP = 0x20000000; const uint MNS_AUTODISMISS = 0x10000000; const uint MNS_NOTIFYBYPOS = 0x08000000; const uint MNS_CHECKORBMP = 0x04000000; const uint MIM_MAXHEIGHT = 0x00000001; const uint MIM_BACKGROUND = 0x00000002; const uint MIM_HELPID = 0x00000004; const uint MIM_MENUDATA = 0x00000008; const uint MIM_STYLE = 0x00000010; const uint MIM_APPLYTOSUBMENUS = 0x80000000; struct MENUINFO { DWORD cbSize; DWORD fMask; DWORD dwStyle; UINT cyMax; HBRUSH hbrBack; DWORD dwContextHelpID; DWORD dwMenuData; } typedef MENUINFO *LPCMENUINFO; [extern "user32.dll"] BOOL GetMenuInfo (HMENU hmenu, LPCMENUINFO m); [extern "user32.dll"] BOOL SetMenuInfo (HMENU hmenu, LPCMENUINFO m); [extern "user32.dll"] BOOL EndMenu (); const int MND_CONTINUE = 0; const int MND_ENDMENU = 1; struct MENUGETOBJECTINFO { DWORD dwFlags; UINT uPos; HMENU hmenu; PVOID riid; PVOID pvObj; } const uint MNGOF_GAP = 0x00000003; const uint MNGO_NOINTERFACE = 0x00000000; const uint MNGO_NOERROR = 0x00000001; const uint MIIM_STATE = 0x00000001; const uint MIIM_ID = 0x00000002; const uint MIIM_SUBMENU = 0x00000004; const uint MIIM_CHECKMARKS = 0x00000008; const uint MIIM_TYPE = 0x00000010; const uint MIIM_DATA = 0x00000020; const uint MIIM_STRING = 0x00000040; const uint MIIM_BITMAP = 0x00000080; const uint MIIM_FTYPE = 0x00000100; const uint HBMMENU_CALLBACK = ((HBITMAP) HBITMAP'max); const uint HBMMENU_SYSTEM = ((HBITMAP) 1); const uint HBMMENU_MBAR_RESTORE = ((HBITMAP) 2); const uint HBMMENU_MBAR_MINIMIZE = ((HBITMAP) 3); const uint HBMMENU_MBAR_CLOSE = ((HBITMAP) 5); const uint HBMMENU_MBAR_CLOSE_D = ((HBITMAP) 6); const uint HBMMENU_MBAR_MINIMIZE_D = ((HBITMAP) 7); const uint HBMMENU_POPUP_CLOSE = ((HBITMAP) 8); const uint HBMMENU_POPUP_RESTORE = ((HBITMAP) 9); const uint HBMMENU_POPUP_MAXIMIZE = ((HBITMAP) 10); const uint HBMMENU_POPUP_MINIMIZE = ((HBITMAP) 11); struct MENUITEMINFOA { UINT cbSize; UINT fMask; UINT fType; UINT fState; UINT wID; HMENU hSubMenu; HBITMAP hbmpChecked; HBITMAP hbmpUnchecked; DWORD dwItemData; LPSTR dwTypeData; UINT cch; HBITMAP hbmpItem; } typedef MENUITEMINFOA* LPMENUITEMINFOA; struct MENUITEMINFOW { UINT cbSize; UINT fMask; UINT fType; UINT fState; UINT wID; HMENU hSubMenu; HBITMAP hbmpChecked; HBITMAP hbmpUnchecked; DWORD dwItemData; LPWSTR dwTypeData; UINT cch; HBITMAP hbmpItem; } typedef MENUITEMINFOW* LPMENUITEMINFOW; [extern "user32.dll"] BOOL InsertMenuItemA (HMENU hmenu, UINT u, BOOL b, LPMENUITEMINFOA m); [extern "user32.dll"] BOOL InsertMenuItemW (HMENU hmenu, UINT u, BOOL b, LPMENUITEMINFOW m); [extern "user32.dll"] BOOL GetMenuItemInfoA (HMENU hmenu, UINT u, BOOL b, LPMENUITEMINFOA m); [extern "user32.dll"] BOOL GetMenuItemInfoW (HMENU hmenu, UINT u, BOOL b, LPMENUITEMINFOW m); [extern "user32.dll"] BOOL SetMenuItemInfoA (HMENU hmenu, UINT u, BOOL b, LPMENUITEMINFOA m); [extern "user32.dll"] BOOL SetMenuItemInfoW (HMENU hmenu, UINT u, BOOL b, LPMENUITEMINFOW m); const int GMDI_USEDISABLED = 0x0001; const int GMDI_GOINTOPOPUPS = 0x0002; [extern "user32.dll"] UINT GetMenuDefaultItem(HMENU hMenu, UINT fByPos, UINT gmdiFlags); [extern "user32.dll"] BOOL SetMenuDefaultItem(HMENU hMenu, UINT uItem, UINT fByPos); [extern "user32.dll"] BOOL GetMenuItemRect (HWND hWnd, HMENU hMenu, UINT uItem, RECT lprcItem); [extern "user32.dll"] int MenuItemFromPoint (HWND hWnd, HMENU hMenu, POINT ptScreen); const uint TPM_LEFTBUTTON = 0x0000; const uint TPM_RIGHTBUTTON = 0x0002; const uint TPM_LEFTALIGN = 0x0000; const uint TPM_CENTERALIGN = 0x0004; const uint TPM_RIGHTALIGN = 0x0008; const uint TPM_TOPALIGN = 0x0000; const uint TPM_VCENTERALIGN = 0x0010; const uint TPM_BOTTOMALIGN = 0x0020; const uint TPM_HORIZONTAL = 0x0000; const uint TPM_VERTICAL = 0x0040; const uint TPM_NONOTIFY = 0x0080; const uint TPM_RETURNCMD = 0x0100; const uint TPM_RECURSE = 0x0001; const uint MF_INSERT = 0x00000000; const uint MF_CHANGE = 0x00000080; const uint MF_APPEND = 0x00000100; const uint MF_DELETE = 0x00000200; const uint MF_REMOVE = 0x00001000; const uint MF_BYCOMMAND = 0x00000000; const uint MF_BYPOSITION = 0x00000400; const uint MF_SEPARATOR = 0x00000800; const uint MF_ENABLED = 0x00000000; const uint MF_GRAYED = 0x00000001; const uint MF_DISABLED = 0x00000002; const uint MF_UNCHECKED = 0x00000000; const uint MF_CHECKED = 0x00000008; const uint MF_USECHECKBITMAPS = 0x00000200; const uint MF_STRING = 0x00000000; const uint MF_BITMAP = 0x00000004; const uint MF_OWNERDRAW = 0x00000100; const uint MF_POPUP = 0x00000010; const uint MF_MENUBARBREAK = 0x00000020; const uint MF_MENUBREAK = 0x00000040; const uint MF_UNHILITE = 0x00000000; const uint MF_HILITE = 0x00000080; const uint MF_DEFAULT = 0x00001000; const uint MF_SYSMENU = 0x00002000; const uint MF_HELP = 0x00004000; const uint MF_RIGHTJUSTIFY = 0x00004000; const uint MF_MOUSESELECT = 0x00008000; const uint MF_END = 0x00000080; const uint MFT_STRING = MF_STRING; const uint MFT_BITMAP = MF_BITMAP; const uint MFT_MENUBARBREAK = MF_MENUBARBREAK; const uint MFT_MENUBREAK = MF_MENUBREAK; const uint MFT_OWNERDRAW = MF_OWNERDRAW; const uint MFT_RADIOCHECK = 0x00000200; const uint MFT_SEPARATOR = MF_SEPARATOR; const uint MFT_RIGHTORDER = 0x00002000; const uint MFT_RIGHTJUSTIFY = MF_RIGHTJUSTIFY; const uint MFS_GRAYED = 0x00000003; const uint MFS_DISABLED = MFS_GRAYED; const uint MFS_CHECKED = MF_CHECKED; const uint MFS_HILITE = MF_HILITE; const uint MFS_ENABLED = MF_ENABLED; const uint MFS_UNCHECKED = MF_UNCHECKED; const uint MFS_UNHILITE = MF_UNHILITE; const uint MFS_DEFAULT = MF_DEFAULT; const uint MFS_MASK = 0x0000108B; const uint MFS_HOTTRACKDRAWN = 0x10000000; const uint MFS_CACHEDBMP = 0x20000000; const uint MFS_BOTTOMGAPDROP = 0x40000000; const uint MFS_TOPGAPDROP = 0x80000000; const uint MFS_GAPDROP = 0xC0000000; const uint EN_SETFOCUS = 0x0100; const uint EN_KILLFOCUS = 0x0200; const uint EN_CHANGE = 0x0300; const uint EN_UPDATE = 0x0400; const uint EN_ERRSPACE = 0x0500; const uint EN_MAXTEXT = 0x0501; const uint EN_HSCROLL = 0x0601; const uint EN_VSCROLL = 0x0602; const uint EC_LEFTMARGIN = 0x0001; const uint EC_RIGHTMARGIN = 0x0002; const uint EC_USEFONTINFO = 0xffff; const uint EMSIS_COMPOSITIONSTRING =0x0001; const uint EIMES_GETCOMPSTRATONCE =0x0001; const uint EIMES_CANCELCOMPSTRINFOCUS =0x0002; const uint EIMES_COMPLETECOMPSTRKILLFOCUS =0x0004; const uint WB_LEFT = 0; const uint WB_RIGHT = 1; const uint WB_ISDELIMITER = 2; const uint BS_PUSHBUTTON = 0x00000000; const uint BS_DEFPUSHBUTTON = 0x00000001; const uint BS_CHECKBOX = 0x00000002; const uint BS_AUTOCHECKBOX = 0x00000003; const uint BS_RADIOBUTTON = 0x00000004; const uint BS_3STATE = 0x00000005; const uint BS_AUTO3STATE = 0x00000006; const uint BS_GROUPBOX = 0x00000007; const uint BS_USERBUTTON = 0x00000008; const uint BS_AUTORADIOBUTTON = 0x00000009; const uint BS_OWNERDRAW = 0x0000000B; const uint BS_LEFTTEXT = 0x00000020; const uint BS_TEXT = 0x00000000; const uint BS_ICON = 0x00000040; const uint BS_BITMAP = 0x00000080; const uint BS_LEFT = 0x00000100; const uint BS_RIGHT = 0x00000200; const uint BS_CENTER = 0x00000300; const uint BS_TOP = 0x00000400; const uint BS_BOTTOM = 0x00000800; const uint BS_VCENTER = 0x00000C00; const uint BS_PUSHLIKE = 0x00001000; const uint BS_MULTILINE = 0x00002000; const uint BS_NOTIFY = 0x00004000; const uint BS_FLAT = 0x00008000; const uint BS_RIGHTBUTTON = BS_LEFTTEXT; const uint BN_CLICKED = 0; const uint BN_PAINT = 1; const uint BN_HILITE = 2; const uint BN_UNHILITE = 3; const uint BN_DISABLE = 4; const uint BN_DOUBLECLICKED = 5; const uint BN_PUSHED = BN_HILITE; const uint BN_UNPUSHED = BN_UNHILITE; const uint BN_DBLCLK = BN_DOUBLECLICKED; const uint BN_SETFOCUS = 6; const uint BN_KILLFOCUS = 7; const uint BM_GETCHECK = 0x00F0; const uint BM_SETCHECK = 0x00F1; const uint BM_GETSTATE = 0x00F2; const uint BM_SETSTATE = 0x00F3; const uint BM_SETSTYLE = 0x00F4; const uint BM_CLICK = 0x00F5; const uint BM_GETIMAGE = 0x00F6; const uint BM_SETIMAGE = 0x00F7; const uint BST_UNCHECKED = 0x0000; const uint BST_CHECKED = 0x0001; const uint BST_INDETERMINATE = 0x0002; const uint BST_PUSHED = 0x0004; const uint BST_FOCUS = 0x0008; const uint SS_LEFT = 0x00000000; const uint SS_CENTER = 0x00000001; const uint SS_RIGHT = 0x00000002; const uint SS_ICON = 0x00000003; const uint SS_BLACKRECT = 0x00000004; const uint SS_GRAYRECT = 0x00000005; const uint SS_WHITERECT = 0x00000006; const uint SS_BLACKFRAME = 0x00000007; const uint SS_GRAYFRAME = 0x00000008; const uint SS_WHITEFRAME = 0x00000009; const uint SS_USERITEM = 0x0000000A; const uint SS_SIMPLE = 0x0000000B; const uint SS_LEFTNOWORDWRAP = 0x0000000C; const uint SS_OWNERDRAW = 0x0000000D; const uint SS_BITMAP = 0x0000000E; const uint SS_ENHMETAFILE = 0x0000000F; const uint SS_ETCHEDHORZ = 0x00000010; const uint SS_ETCHEDVERT = 0x00000011; const uint SS_ETCHEDFRAME = 0x00000012; const uint SS_TYPEMASK = 0x0000001F; const uint SS_NOPREFIX = 0x00000080; const uint SS_NOTIFY = 0x00000100; const uint SS_CENTERIMAGE = 0x00000200; const uint SS_RIGHTJUST = 0x00000400; const uint SS_REALSIZEIMAGE = 0x00000800; const uint SS_SUNKEN = 0x00001000; const uint SS_ENDELLIPSIS = 0x00004000; const uint SS_PATHELLIPSIS = 0x00008000; const uint SS_WORDELLIPSIS = 0x0000C000; const uint SS_ELLIPSISMASK = 0x0000C000; const uint STM_SETICON = 0x0170; const uint STM_GETICON = 0x0171; const uint STM_SETIMAGE = 0x0172; const uint STM_GETIMAGE = 0x0173; const uint STN_CLICKED = 0; const uint STN_DBLCLK = 1; const uint STN_ENABLE = 2; const uint STN_DISABLE = 3; const int LB_OKAY = 0; const int LB_ERR = (-1); const int LBN_ERRSPACE = (-2); const int LBN_SELCHANGE = 1; const int LBN_DBLCLK = 2; const int LBN_SELCANCEL = 3; const int LBN_SETFOCUS = 4; const int LBN_KILLFOCUS = 5; const uint LB_ADDSTRING = 0x0180; const uint LB_INSERTSTRING = 0x0181; const uint LB_DELETESTRING = 0x0182; const uint LB_SELITEMRANGEEX = 0x0183; const uint LB_RESETCONTENT = 0x0184; const uint LB_SETSEL = 0x0185; const uint LB_SETCURSEL = 0x0186; const uint LB_GETSEL = 0x0187; const uint LB_GETCURSEL = 0x0188; const uint LB_GETTEXT = 0x0189; const uint LB_GETTEXTLEN = 0x018A; const uint LB_GETCOUNT = 0x018B; const uint LB_SELECTSTRING = 0x018C; const uint LB_DIR = 0x018D; const uint LB_GETTOPINDEX = 0x018E; const uint LB_FINDSTRING = 0x018F; const uint LB_GETSELCOUNT = 0x0190; const uint LB_GETSELITEMS = 0x0191; const uint LB_SETTABSTOPS = 0x0192; const uint LB_GETHORIZONTALEXTENT= 0x0193; const uint LB_SETHORIZONTALEXTENT= 0x0194; const uint LB_SETCOLUMNWIDTH = 0x0195; const uint LB_ADDFILE = 0x0196; const uint LB_SETTOPINDEX = 0x0197; const uint LB_GETITEMRECT = 0x0198; const uint LB_GETITEMDATA = 0x0199; const uint LB_SETITEMDATA = 0x019A; const uint LB_SELITEMRANGE = 0x019B; const uint LB_SETANCHORINDEX = 0x019C; const uint LB_GETANCHORINDEX = 0x019D; const uint LB_SETCARETINDEX = 0x019E; const uint LB_GETCARETINDEX = 0x019F; const uint LB_SETITEMHEIGHT = 0x01A0; const uint LB_GETITEMHEIGHT = 0x01A1; const uint LB_FINDSTRINGEXACT = 0x01A2; const uint LB_SETLOCALE = 0x01A5; const uint LB_GETLOCALE = 0x01A6; const uint LB_SETCOUNT = 0x01A7; const uint LB_INITSTORAGE = 0x01A8; const uint LB_ITEMFROMPOINT = 0x01A9; const uint LBS_NOTIFY = 0x0001; const uint LBS_SORT = 0x0002; const uint LBS_NOREDRAW = 0x0004; const uint LBS_MULTIPLESEL = 0x0008; const uint LBS_OWNERDRAWFIXED = 0x0010; const uint LBS_OWNERDRAWVARIABLE= 0x0020; const uint LBS_HASSTRINGS = 0x0040; const uint LBS_USETABSTOPS = 0x0080; const uint LBS_NOINTEGRALHEIGHT = 0x0100; const uint LBS_MULTICOLUMN = 0x0200; const uint LBS_WANTKEYBOARDINPUT= 0x0400; const uint LBS_EXTENDEDSEL = 0x0800; const uint LBS_DISABLENOSCROLL = 0x1000; const uint LBS_NODATA = 0x2000; const uint LBS_NOSEL = 0x4000; const uint LBS_STANDARD = (LBS_NOTIFY | LBS_SORT | WS_VSCROLL | WS_BORDER); const int CB_OKAY = 0; const int CB_ERR = (-1); const int CB_ERRSPACE = (-2); const int CBN_ERRSPACE = (-1); const int CBN_SELCHANGE = 1; const int CBN_DBLCLK = 2; const int CBN_SETFOCUS = 3; const int CBN_KILLFOCUS = 4; const int CBN_EDITCHANGE = 5; const int CBN_EDITUPDATE = 6; const int CBN_DROPDOWN = 7; const int CBN_CLOSEUP = 8; const int CBN_SELENDOK = 9; const int CBN_SELENDCANCEL = 10; const uint CBS_SIMPLE = 0x0001; const uint CBS_DROPDOWN = 0x0002; const uint CBS_DROPDOWNLIST = 0x0003; const uint CBS_OWNERDRAWFIXED = 0x0010; const uint CBS_OWNERDRAWVARIABLE= 0x0020; const uint CBS_AUTOHSCROLL = 0x0040; const uint CBS_OEMCONVERT = 0x0080; const uint CBS_SORT = 0x0100; const uint CBS_HASSTRINGS = 0x0200; const uint CBS_NOINTEGRALHEIGHT = 0x0400; const uint CBS_DISABLENOSCROLL = 0x0800; const uint CBS_UPPERCASE = 0x2000; const uint CBS_LOWERCASE = 0x4000; const uint CB_GETEDITSEL = 0x0140; const uint CB_LIMITTEXT = 0x0141; const uint CB_SETEDITSEL = 0x0142; const uint CB_ADDSTRING = 0x0143; const uint CB_DELETESTRING = 0x0144; const uint CB_DIR = 0x0145; const uint CB_GETCOUNT = 0x0146; const uint CB_GETCURSEL = 0x0147; const uint CB_GETLBTEXT = 0x0148; const uint CB_GETLBTEXTLEN = 0x0149; const uint CB_INSERTSTRING = 0x014A; const uint CB_RESETCONTENT = 0x014B; const uint CB_FINDSTRING = 0x014C; const uint CB_SELECTSTRING = 0x014D; const uint CB_SETCURSEL = 0x014E; const uint CB_SHOWDROPDOWN = 0x014F; const uint CB_GETITEMDATA = 0x0150; const uint CB_SETITEMDATA = 0x0151; const uint CB_GETDROPPEDCONTROLRECT = 0x0152; const uint CB_SETITEMHEIGHT = 0x0153; const uint CB_GETITEMHEIGHT = 0x0154; const uint CB_SETEXTENDEDUI = 0x0155; const uint CB_GETEXTENDEDUI = 0x0156; const uint CB_GETDROPPEDSTATE = 0x0157; const uint CB_FINDSTRINGEXACT = 0x0158; const uint CB_SETLOCALE = 0x0159; const uint CB_GETLOCALE = 0x015A; const uint CB_GETTOPINDEX = 0x015b; const uint CB_SETTOPINDEX = 0x015c; const uint CB_GETHORIZONTALEXTENT = 0x015d; const uint CB_SETHORIZONTALEXTENT = 0x015e; const uint CB_GETDROPPEDWIDTH = 0x015f; const uint CB_SETDROPPEDWIDTH = 0x0160; const uint CB_INITSTORAGE = 0x0161; typedef HANDLE HCRYPTPROV; const DWORD PROV_RSA_FULL = 1; const DWORD CRYPT_VERIFYCONTEXT = 0xF0000000; const DWORD CRYPT_SILENT = 64; // don't ever display a UI to the user [extern "advapi32.dll"] BOOL CryptAcquireContextW ( HCRYPTPROV *phProv, LPCTSTR pszContainer, LPCTSTR pszProvider, DWORD dwProvType, DWORD dwFlags); [extern "advapi32.dll"] BOOL CryptGenRandom ( HCRYPTPROV hProv, DWORD dwLen, BYTE *pbBuffer); [extern "advapi32.dll"] BOOL CryptReleaseContext (HCRYPTPROV hProv, DWORD dwFlags); //------------------------------------------------------------------------------ [extern "user32.dll"] HWND SetCapture (HWND hWnd); [extern "user32.dll"] BOOL ReleaseCapture(); //-------------------------------------------------------------------------- [extern "kernel32.dll"] HMODULE LoadLibraryA (LPCTSTR lpFileName); [extern "kernel32.dll"] byte* GetProcessHeap(); // returns heap [extern "kernel32.dll"] byte* HeapAlloc (byte* heap, int flags, uint size); // flags = 4 == generate exceptions [extern "kernel32.dll"] int HeapFree (byte* heap, int flags, byte* mem); [extern "kernel32.dll"] int HeapSize (byte *heap, DWORD dwFlags, byte* mem); typedef [callback] BOOL WNDENUMPROC(HWND hwnd, LPARAM lParam); [extern "user32.dll"] BOOL EnumWindows (WNDENUMPROC lpEnumFunc, LPARAM lParam); [extern "user32.dll"] HCURSOR SetCursor (HCURSOR hCursor); [extern "gdi32.dll"] BOOL SetViewportOrgEx (HDC hdc, int X, int Y, POINT* lpPoint); //------------------------------------------------------------------------------ struct OPENFILENAMEA { DWORD lStructSize; HWND hwndOwner; HINSTANCE hInstance; LPCSTR lpstrFilter; LPSTR lpstrCustomFilter; DWORD nMaxCustFilter; DWORD nFilterIndex; LPSTR lpstrFile; DWORD nMaxFile; LPSTR lpstrFileTitle; DWORD nMaxFileTitle; LPCSTR lpstrInitialDir; LPCSTR lpstrTitle; DWORD Flags; WORD nFileOffset; WORD nFileExtension; LPCSTR lpstrDefExt; LPARAM lCustData; byte* lpfnHook; LPCSTR lpTemplateName; } [extern "Comdlg32.dll"] BOOL GetOpenFileNameA (ref OPENFILENAMEA lpofn); [extern "Comdlg32.dll"] BOOL GetSaveFileNameA (ref OPENFILENAMEA lpofn); const DWORD OFN_READONLY = 1; const DWORD OFN_OVERWRITEPROMPT = 2; const DWORD OFN_HIDEREADONLY = 4; const DWORD OFN_PATHMUSTEXIST = 0x0800; const DWORD OFN_SHAREAWARE = 0x4000; const DWORD OFN_FILEMUSTEXIST = 0x1000; const DWORD OFN_NOTESTFILECREATE = 0x10000; //------------------------------------------------------------------------------ [extern "kernel32.dll"] BOOL TerminateThread (HANDLE hThread, DWORD dwExitCode); [extern "kernel32.dll"] BOOL DuplicateHandle (HANDLE hSourceProcessHandle, HANDLE hSourceHandle, HANDLE hTargetProcessHandle, HANDLE *lpTargetHandle, DWORD dwDesiredAccess, BOOL bInheritHandle, DWORD dwOptions); const DWORD DUPLICATE_SAME_ACCESS = 0x00000002; [extern "kernel32.dll"] HANDLE GetCurrentProcess (); [extern "kernel32.dll"] HANDLE GetCurrentThread(); //------------------------------------------------------------------------------ byte *malloc (uint size); void freem (byte *p); uint heapsize (byte *p); // returns size of allocated block byte *realloc (byte *p, uint size); //------------------------------------------------------------------------------ HWND main_hWnd; // handle of main window //------------------------------------------------------------------------------ #end unsafe //------------------------------------------------------------------------------