; =============================================================================================================================== ; Win32.nh - The Win32 API header (excerpt, converted to NASM syntax) ; ------------------------------------------------------------------------------------------------------------------------------- ; Copyright (C) 2003 by Remage / Fresh!mindworkz ; =============================================================================================================================== %ifndef __FRESH_MINDWORKZ_WIN32_NH %define __FRESH_MINDWORKZ_WIN32_NH ; ------------------------------------------------------------------------------------------------------------------------------- ; Defines ; ------------------------------------------------------------------------------------------------------------------------------- %define WINVER 0x0500 ; ----- Window class styles ----------------------------------------------------------------------------------------------------- %define CS_VREDRAW 0x0001 %define CS_VREDRAW 0x0001 %define CS_HREDRAW 0x0002 %define CS_KEYCVTWINDOW 0x0004 %define CS_DBLCLKS 0x0008 %define CS_OWNDC 0x0020 %define CS_CLASSDC 0x0040 %define CS_PARENTDC 0x0080 %define CS_NOKEYCVT 0x0100 %define CS_SAVEBITS 0x0800 %define CS_NOCLOSE 0x0200 %define CS_BYTEALIGNCLIENT 0x1000 %define CS_BYTEALIGNWINDOW 0x2000 %define CS_GLOBALCLASS 0x4000 ; Global window class. ; ----- Window styles ----------------------------------------------------------------------------------------------------------- %define WS_OVERLAPPED 0x000000000 %define WS_ICONICPOPUP 0x0C0000000 %define WS_POPUP 0x080000000 %define WS_CHILD 0x040000000 %define WS_MINIMIZE 0x020000000 %define WS_VISIBLE 0x010000000 %define WS_DISABLED 0x008000000 %define WS_CLIPSIBLINGS 0x004000000 %define WS_CLIPCHILDREN 0x002000000 %define WS_MAXIMIZE 0x001000000 %define WS_CAPTION 0x000C00000 ; WS_BORDER | WS_DLGFRAME %define WS_BORDER 0x000800000 %define WS_DLGFRAME 0x000400000 %define WS_VSCROLL 0x000200000 %define WS_HSCROLL 0x000100000 %define WS_SYSMENU 0x000080000 %define WS_THICKFRAME 0x000040000 %define WS_HREDRAW 0x000020000 %define WS_VREDRAW 0x000010000 %define WS_GROUP 0x000020000 %define WS_TABSTOP 0x000010000 %define WS_MINIMIZEBOX 0x000020000 %define WS_MAXIMIZEBOX 0x000010000 ; ----- Predefined cursor and icon IDs ------------------------------------------------------------------------------------------ %define IDI_APPLICATION 32512 %define IDI_HAND 32513 %define IDI_QUESTION 32514 %define IDI_EXCLAMATION 32515 %define IDI_ASTERISK 32516 ; ----- ShowWindow() commands --------------------------------------------------------------------------------------------------- %define SW_HIDE 0 %define SW_SHOWNORMAL 1 %define SW_NORMAL 1 %define SW_SHOWMINIMIZED 2 %define SW_SHOWMAXIMIZED 3 %define SW_MAXIMIZE 3 %define SW_SHOWNOACTIVATE 4 %define SW_SHOW 5 %define SW_MINIMIZE 6 %define SW_SHOWMINNOACTIVE 7 %define SW_SHOWNA 8 %define SW_RESTORE 9 ; ----- Window messages --------------------------------------------------------------------------------------------------------- %define WM_STATE 0x0000 %define WM_NULL 0x0000 %define WM_CREATE 0x0001 %define WM_DESTROY 0x0002 %define WM_MOVE 0x0003 %define WM_SIZE 0x0005 %define WM_ACTIVATE 0x0006 %define WM_SETFOCUS 0x0007 %define WM_KILLFOCUS 0x0008 %define WM_ENABLE 0x000A %define WM_SETREDRAW 0x000B %define WM_SETTEXT 0x000C %define WM_GETTEXT 0x000D %define WM_GETTEXTLENGTH 0x000E %define WM_PAINT 0x000F %define WM_CLOSE 0x0010 %define WM_QUERYENDSESSION 0x0011 %define WM_QUIT 0x0012 %define WM_QUERYOPEN 0x0013 %define WM_ERASEBKGND 0x0014 %define WM_SYSCOLORCHANGE 0x0015 %define WM_ENDSESSION 0x0016 %define WM_SYSTEMERROR 0x0017 %define WM_SHOWWINDOW 0x0018 %define WM_CTLCOLOR 0x0019 %define WM_WININICHANGE 0x001A %define WM_DEVMODECHANGE 0x001B %define WM_ACTIVATEAPP 0x001C %define WM_FONTCHANGE 0x001D %define WM_TIMECHANGE 0x001E %define WM_CANCELMODE 0x001F %define WM_SETCURSOR 0x0020 %define WM_MOUSEACTIVATE 0x0021 %define WM_CHILDACTIVATE 0x0022 %define WM_QUEUESYNC 0x0023 %define WM_GETMINMAXINFO 0x0024 %define WM_PAINTICON 0x0026 %define WM_ICONERASEBKGND 0x0027 %define WM_NEXTDLGCTL 0x0028 %define WM_SPOOLERSTATUS 0x002A %define WM_DRAWITEM 0x002B %define WM_MEASUREITEM 0x002C %define WM_DELETEITEM 0x002D %define WM_VKEYTOITEM 0x002E %define WM_CHARTOITEM 0x002F %define WM_SETFONT 0x0030 %define WM_GETFONT 0x0031 %define WM_QUERYDRAGICON 0x0037 %define WM_COMPAREITEM 0x0039 %define WM_COMPACTING 0x0041 %define WM_COMMNOTIFY 0x0044 %define WM_WINDOWPOSCHANGING 0x0046 %define WM_WINDOWPOSCHANGED 0x0047 %define WM_POWER 0x0048 WM_NCCREATE equ 0x0081 WM_NCDESTROY equ 0x0082 WM_NCCALCSIZE equ 0x0083 WM_NCHITTEST equ 0x0084 WM_NCPAINT equ 0x0085 WM_NCACTIVATE equ 0x0086 WM_GETDLGCODE equ 0x0087 WM_NCMOUSEMOVE equ 0x00A0 WM_NCLBUTTONDOWN equ 0x00A1 WM_NCLBUTTONUP equ 0x00A2 WM_NCLBUTTONDBLCLK equ 0x00A3 WM_NCRBUTTONDOWN equ 0x00A4 WM_NCRBUTTONUP equ 0x00A5 WM_NCRBUTTONDBLCLK equ 0x00A6 WM_NCMBUTTONDOWN equ 0x00A7 WM_NCMBUTTONUP equ 0x00A8 WM_NCMBUTTONDBLCLK equ 0x00A9 WM_KEYFIRST equ 0x0100 WM_KEYDOWN equ 0x0100 WM_KEYUP equ 0x0101 WM_CHAR equ 0x0102 WM_DEADCHAR equ 0x0103 WM_SYSKEYDOWN equ 0x0104 WM_SYSKEYUP equ 0x0105 WM_SYSCHAR equ 0x0106 WM_SYSDEADCHAR equ 0x0107 WM_KEYLAST equ 0x0108 WM_INITDIALOG equ 0x0110 WM_COMMAND equ 0x0111 WM_SYSCOMMAND equ 0x0112 WM_TIMER equ 0x0113 WM_HSCROLL equ 0x0114 WM_VSCROLL equ 0x0115 WM_INITMENU equ 0x0116 WM_INITMENUPOPUP equ 0x0117 WM_MENUSELECT equ 0x011F WM_MENUCHAR equ 0x0120 WM_ENTERIDLE equ 0x0121 WM_MOUSEFIRST equ 0x0200 WM_MOUSEMOVE equ 0x0200 WM_LBUTTONDOWN equ 0x0201 WM_LBUTTONUP equ 0x0202 WM_LBUTTONDBLCLK equ 0x0203 WM_RBUTTONDOWN equ 0x0204 WM_RBUTTONUP equ 0x0205 WM_RBUTTONDBLCLK equ 0x0206 WM_MBUTTONDOWN equ 0x0207 WM_MBUTTONUP equ 0x0208 WM_MBUTTONDBLCLK equ 0x0209 WM_MOUSELAST equ 0x0209 WM_PARENTNOTIFY equ 0x0210 WM_MDICREATE equ 0x0220 WM_MDIDESTROY equ 0x0221 WM_MDIACTIVATE equ 0x0222 WM_MDIRESTORE equ 0x0223 WM_MDINEXT equ 0x0224 WM_MDIMAXIMIZE equ 0x0225 WM_MDITILE equ 0x0226 WM_MDICASCADE equ 0x0227 WM_MDIICONARRANGE equ 0x0228 WM_MDIGETACTIVE equ 0x0229 WM_MDISETMENU equ 0x0230 WM_DROPFILES equ 0x0233 WM_CUT equ 0x0300 WM_COPY equ 0x0301 WM_PASTE equ 0x0302 WM_CLEAR equ 0x0303 WM_UNDO equ 0x0304 WM_RENDERFORMAT equ 0x0305 WM_RENDERALLFORMATS equ 0x0306 WM_DESTROYCLIPBOARD equ 0x0307 WM_DRAWCLIPBOARD equ 0x0308 WM_PAINTCLIPBOARD equ 0x0309 WM_VSCROLLCLIPBOARD equ 0x030A WM_SIZECLIPBOARD equ 0x030B WM_ASKCBFORMATNAME equ 0x030C WM_CHANGECBCHAIN equ 0x030D WM_HSCROLLCLIPBOARD equ 0x030E WM_QUERYNEWPALETTE equ 0x030F WM_PALETTEISCHANGING equ 0x0310 WM_PALETTECHANGED equ 0x0311 WM_PENWINFIRST equ 0x0380 WM_PENWINLAST equ 0x038F WM_COALESCE_FIRST equ 0x0390 WM_COALESCE_LAST equ 0x039F WM_USER equ 0x0400 ; ----- Virtual key codes. %define VK_LBUTTON 0x01 %define VK_RBUTTON 0x02 %define VK_CANCEL 0x03 %define VK_MBUTTON 0x04 ; NOT contiguous with L & RBUTTON %define VK_BACK 0x08 %define VK_TAB 0x09 %define VK_CLEAR 0x0C %define VK_RETURN 0x0D %define VK_SHIFT 0x10 %define VK_CONTROL 0x11 %define VK_MENU 0x12 %define VK_PAUSE 0x13 %define VK_CAPITAL 0x14 %define VK_KANA 0x15 %define VK_HANGEUL 0x15 ; old name - should be here for compatibility %define VK_HANGUL 0x15 %define VK_JUNJA 0x17 %define VK_FINAL 0x18 %define VK_HANJA 0x19 %define VK_KANJI 0x19 %define VK_ESCAPE 0x1B %define VK_CONVERT 0x1C %define VK_NONCONVERT 0x1D %define VK_ACCEPT 0x1E %define VK_MODECHANGE 0x1F %define VK_SPACE 0x20 %define VK_PRIOR 0x21 %define VK_NEXT 0x22 %define VK_END 0x23 %define VK_HOME 0x24 %define VK_LEFT 0x25 %define VK_UP 0x26 %define VK_RIGHT 0x27 %define VK_DOWN 0x28 %define VK_SELECT 0x29 %define VK_PRINT 0x2A %define VK_EXECUTE 0x2B %define VK_SNAPSHOT 0x2C %define VK_INSERT 0x2D %define VK_DELETE 0x2E %define VK_HELP 0x2F ; VK_0 thru VK_9 are the same as ASCII '0' thru '9' (0x30 - 0x39) ; VK_A thru VK_Z are the same as ASCII 'A' thru 'Z' (0x41 - 0x5A) %define VK_LWIN 0x5B %define VK_RWIN 0x5C %define VK_APPS 0x5D %define VK_NUMPAD0 0x60 %define VK_NUMPAD1 0x61 %define VK_NUMPAD2 0x62 %define VK_NUMPAD3 0x63 %define VK_NUMPAD4 0x64 %define VK_NUMPAD5 0x65 %define VK_NUMPAD6 0x66 %define VK_NUMPAD7 0x67 %define VK_NUMPAD8 0x68 %define VK_NUMPAD9 0x69 %define VK_MULTIPLY 0x6A %define VK_ADD 0x6B %define VK_SEPARATOR 0x6C %define VK_SUBTRACT 0x6D %define VK_DECIMAL 0x6E %define VK_DIVIDE 0x6F %define VK_F1 0x70 %define VK_F2 0x71 %define VK_F3 0x72 %define VK_F4 0x73 %define VK_F5 0x74 %define VK_F6 0x75 %define VK_F7 0x76 %define VK_F8 0x77 %define VK_F9 0x78 %define VK_F10 0x79 %define VK_F11 0x7A %define VK_F12 0x7B %define VK_F13 0x7C %define VK_F14 0x7D %define VK_F15 0x7E %define VK_F16 0x7F %define VK_F17 0x80 %define VK_F18 0x81 %define VK_F19 0x82 %define VK_F20 0x83 %define VK_F21 0x84 %define VK_F22 0x85 %define VK_F23 0x86 %define VK_F24 0x87 %define VK_NUMLOCK 0x90 %define VK_SCROLL 0x91 ; VK_L* & VK_R* - left and right Alt, Ctrl and Shift virtual keys. ; Used only as parameters to GetAsyncKeyState() and GetKeyState(). ; No other API or message will distinguish left and right keys in this way. %define VK_LSHIFT 0xA0 %define VK_RSHIFT 0xA1 %define VK_LCONTROL 0xA2 %define VK_RCONTROL 0xA3 %define VK_LMENU 0xA4 %define VK_RMENU 0xA5 %if (WINVER >= 0x0400) %define VK_PROCESSKEY 0xE5 %endif %define VK_ATTN 0xF6 %define VK_CRSEL 0xF7 %define VK_EXSEL 0xF8 %define VK_EREOF 0xF9 %define VK_PLAY 0xFA %define VK_ZOOM 0xFB %define VK_NONAME 0xFC %define VK_PA1 0xFD %define VK_OEM_CLEAR 0xFE ; ----- Window class. struc WNDCLASS .Style resd 1 ; Class style. .lpfnWndProc resd 1 .cbClsExtra resd 1 .cbWndExtra resd 1 .hInstance resd 1 ; Instance handle. .hIcon resd 1 ; Class icon handle. .hCursor resd 1 ; Class cursor handle. .hbrBackground resd 1 ; Class background brush. .lpszMenuName resd 1 ; Menu name. .lpszClassName resd 1 ; Class name. .SizeOf endstruc ; ----- Message. struc MSG .hWnd resd 1 .Message resd 1 .wParam resd 1 .lParam resd 1 .Time resd 1 .Pt resd 1 .SizeOf endstruc %define PM_NOREMOVE 0x0000 %define PM_REMOVE 0x0001 %define PM_NOYIELD 0x0002 ; ----- Device mode. CCHDEVICENAME equ 32 CCHFORMNAME equ 32 struc DEVMODE .dmDeviceName resb CCHDEVICENAME .dmSpecVersion resw 1 .dmDriverVersion resw 1 .dmSize resw 1 .dmDriverExtra resw 1 .dmFields resd 1 .dmPosition resq 1 .dmScale resw 1 .dmCopies resw 1 .dmDefaultSource resw 1 .dmPrintQuality resw 1 .dmColor resw 1 .dmDuplex resw 1 .dmYResolution resw 1 .dmTTOption resw 1 .dmCollate resw 1 .dmFormName resb CCHFORMNAME .dmLogPixels resw 1 .dmBitsPerPel resd 1 .dmPelsWidth resd 1 .dmPelsHeight resd 1 .dmDisplayFlags resd 1 .dmDisplayFrequency resd 1 ;%if (WINVER >= 0x0400) .dmICMMethod resd 1 .dmICMIntent resd 1 .dmMediaType resd 1 .dmDitherType resd 1 .dmReserved resd 2 ;%if ((WINVER >= 0x0500) || (_WIN32_WINNT >= 0x0400)) .dmPanningWidth resd 1 .dmPanningHeight resd 1 .SizeOf ;%endif ;%endif endstruc %define DM_BITSPERPEL 0x00040000 %define DM_PELSWIDTH 0x00080000 %define DM_PELSHEIGHT 0x00100000 ; ----- Pixel format descriptor struc PIXELFORMATDESCRIPTOR .nSize resw 1 .nVersion resw 1 .dwFlags resd 1 .iPixelType resb 1 .cColorBits resb 1 .cRedBits resb 1 .cRedShift resb 1 .cGreenBits resb 1 .cGreenShift resb 1 .cBlueBits resb 1 .cBlueShift resb 1 .cAlphaBits resb 1 .cAlphaShift resb 1 .cAccumBits resb 1 .cAccumRedBits resb 1 .cAccumGreenBits resb 1 .cAccumBlueBits resb 1 .cAccumAlphaBits resb 1 .cDepthBits resb 1 .cStencilBits resb 1 .cAuxBuffers resb 1 .iLayerType resb 1 .bReserved resb 1 .dwLayerMask resd 1 .dwVisibleMask resd 1 .dwDamageMask resd 1 .SizeOf endstruc ; ----- Pixel types %define PFD_TYPE_RGBA 0 %define PFD_TYPE_COLORINDEX 1 ; ----- Layer types %define PFD_MAIN_PLANE 0 %define PFD_OVERLAY_PLANE 1 %define PFD_UNDERLAY_PLANE (-1) ; ----- PIXELFORMATDESCRIPTOR flags %define PFD_DOUBLEBUFFER 0x00000001 %define PFD_STEREO 0x00000002 %define PFD_DRAW_TO_WINDOW 0x00000004 %define PFD_DRAW_TO_BITMAP 0x00000008 %define PFD_SUPPORT_GDI 0x00000010 %define PFD_SUPPORT_OPENGL 0x00000020 %define PFD_GENERIC_FORMAT 0x00000040 %define PFD_NEED_PALETTE 0x00000080 %define PFD_NEED_SYSTEM_PALETTE 0x00000100 %define PFD_SWAP_EXCHANGE 0x00000200 %define PFD_SWAP_COPY 0x00000400 %define PFD_SWAP_LAYER_BUFFERS 0x00000800 %define PFD_GENERIC_ACCELERATED 0x00001000 %define PFD_SUPPORT_DIRECTDRAW 0x00002000 ; ----- PIXELFORMATDESCRIPTOR flags for use in ChoosePixelFormat only %define PFD_DEPTH_DONTCARE 0x20000000 %define PFD_DOUBLEBUFFER_DONTCARE 0x40000000 %define PFD_STEREO_DONTCARE 0x80000000 struc WAVEFORMAT .wFormatTag resw 1 .nChannels resw 1 .nSamplesPerSec resd 1 .nAvgBytesPerSec resd 1 .nBlockAlign resw 1 .SizeOf endstruc struc WAVEFORMATEX .wFormatTag resw 1 .nChannels resw 1 .nSamplesPerSec resd 1 .nAvgBytesPerSec resd 1 .nBlockAlign resw 1 .wBitsPerSample resw 1 .cbSize resw 1 .SizeOf endstruc %define WAVE_FORMAT_PCM 0x0001 %define SND_SYNC 0x0000 ; Play synchronously (default) %define SND_ASYNC 0x0001 ; Play asynchronously %define SND_NODEFAULT 0x0002 ; Silence (!default) if sound not found %define SND_MEMORY 0x0004 ; pszSound points to a memory file %define SND_LOOP 0x0008 ; Loop the sound until next sndPlaySound %define SND_NOSTOP 0x0010 ; Don't stop any currently playing sound ; ----- File handling. %define CREATE_ALWAYS 2 %define GENERIC_WRITE 0x40000000 ; ------------------------------------------------------------------------------------------------------------------------------- ; Macro: Import & call external function. ; ------------------------------------------------------------------------------------------------------------------------------- %macro DLLCALL 2 extern %2 import %2 %1.dll call [%2] %endmacro ; ------------------------------------------------------------------------------------------------------------------------------- %endif