📄 windows.h
字号:
/*****************************************************************************\
* *
* windows.h - Windows functions, types, and definitions *
* *
* Version 3.10 *
* *
* Copyright (c) 1985-1992, Microsoft Corp. All rights reserved. *
* *
*******************************************************************************
*
* The following symbols control inclusion of various parts of this file:
*
* WINVER Windows version number (0x030a). To exclude
* definitions introduced in version 3.1 (or above)
* #define WINVER 0x0300 before #including <windows.h>
*
* #define: To prevent inclusion of:
*
* NOKERNEL KERNEL APIs and definitions
* NOGDI GDI APIs and definitions
* NOUSER USER APIs and definitions
* NOSOUND Sound APIs and definitions
* NOCOMM Comm driver APIs and definitions
* NODRIVERS Installable driver APIs and definitions
*
* NOMINMAX min() and max() macros
* NOLOGERROR LogError() and related definitions
* NOPROFILER Profiler APIs
* NOMEMMGR Local and global memory management
* NOLFILEIO _l* file I/O routines
* NOOPENFILE OpenFile and related definitions
* NORESOURCE Resource management
* NOATOM Atom management
* NOLANGUAGE Character test routines
* NOLSTRING lstr* string management routines
* NODBCS Double-byte character set routines
* NOKEYBOARDINFO Keyboard driver routines
* NOGDICAPMASKS GDI device capability constants
* NOCOLOR COLOR_* color values
* NOGDIOBJ GDI pens, brushes, fonts
* NODRAWTEXT DrawText() and related definitions
* NOTEXTMETRIC TEXTMETRIC and related APIs
* NOSCALABLEFONT Truetype scalable font support
* NOBITMAP Bitmap support
* NORASTEROPS GDI Raster operation definitions
* NOMETAFILE Metafile support
* NOSYSMETRICS GetSystemMetrics() and related SM_* definitions
* NOSYSTEMPARAMSINFO SystemParametersInfo() and SPI_* definitions
* NOMSG APIs and definitions that use MSG structure
* NOWINSTYLES Window style definitions
* NOWINOFFSETS Get/SetWindowWord/Long offset definitions
* NOSHOWWINDOW ShowWindow and related definitions
* NODEFERWINDOWPOS DeferWindowPos and related definitions
* NOVIRTUALKEYCODES VK_* virtual key codes
* NOKEYSTATES MK_* message key state flags
* NOWH SetWindowsHook and related WH_* definitions
* NOMENUS Menu APIs
* NOSCROLL Scrolling APIs and scroll bar control
* NOCLIPBOARD Clipboard APIs and definitions
* NOICONS IDI_* icon IDs
* NOMB MessageBox and related definitions
* NOSYSCOMMANDS WM_SYSCOMMAND SC_* definitions
* NOMDI MDI support
* NOCTLMGR Control management and controls
* NOWINMESSAGES WM_* window messages
* NOHELP Help support
*
\****************************************************************************/
#ifndef _INC_WINDOWS
#define _INC_WINDOWS /* #defined if windows.h has been included */
#ifndef RC_INVOKED
#pragma pack(1) /* Assume byte packing throughout */
#endif /* RC_INVOKED */
#ifdef __cplusplus
extern "C" { /* Assume C declarations for C++ */
#endif /* __cplusplus */
#ifdef NOWIN31 /* ;Internal */
#define WINVER 0x0300 /* ;Internal */
#endif /* ;Internal */
/* ;Internal */
/* If WINVER is not defined, assume version 3.1 */
#ifndef WINVER
#define WINVER 0x030a
#endif
#ifdef RC_INVOKED
/* Don't include definitions that RC.EXE can't parse */
#define NOATOM
#define NOGDI
#define NOGDICAPMASKS
#define NOMETAFILE
#define NOMINMAX
#define NOMSG
#define NOOPENFILE
#define NORASTEROPS
#define NOSCROLL
#define NOSOUND
#define NOSYSMETRICS
#define NOTEXTMETRIC
#define NOWH
#define NODBCS
#define NOSYSTEMPARAMSINFO
#define NOCOMM
#define NOOEMRESOURCE
#endif /* RC_INVOKED */
/* Temp internal compatibility hacks */ /* ;Internal */
#define NOOEMRESOURCE /* ;Internal */
#ifdef OEMRESOURCE /* ;Internal */
#undef NOOEMRESOURCE /* ;Internal */
#endif /* ;Internal */
#define NOCOMM /* ;Internal */
#ifdef USECOMM /* ;Internal */
#undef NOCOMM /* ;Internal */
#endif /* ;Internal */
/* ;Internal */
/* Handle OEMRESOURCE for 3.0 compatibility */
#if (WINVER < 0x030a)
#define NOOEMRESOURCE
#ifdef OEMRESOURCE
#undef NOOEMRESOURCE
#endif
#endif
/******* Common definitions and typedefs ***********************************/
#define VOID void
#define FAR _far
#define NEAR _near
#define PASCAL _pascal
#define CDECL _cdecl
#define CONST const /* ;Internal */
#ifdef BUILDDLL /* ;Internal */
#define WINAPI _loadds _far _pascal /* ;Internal */
#define CALLBACK _loadds _far _pascal /* ;Internal */
#else /* ;Internal */
#define WINAPI _far _pascal
#define CALLBACK _far _pascal
#endif /* ;Internal */
/* ;Internal */
#define API WINAPI /* ;Internal */
/****** Simple types & common helper macros *********************************/
typedef int BOOL;
#define FALSE 0
#define TRUE 1
typedef unsigned char BYTE;
typedef unsigned short WORD;
typedef unsigned long DWORD;
typedef unsigned int UINT;
#ifdef STRICT
typedef signed long LONG;
#else
#define LONG long
#endif
#define LOBYTE(w) ((BYTE)(w))
#define HIBYTE(w) ((BYTE)(((UINT)(w) >> 8) & 0xFF))
#define LOWORD(l) ((WORD)(DWORD)(l))
#define HIWORD(l) ((WORD)((((DWORD)(l)) >> 16) & 0xFFFF))
#define MAKELONG(low, high) ((LONG)(((WORD)(low)) | (((DWORD)((WORD)(high))) << 16)))
#ifndef NOMINMAX
#ifndef max
#define max(a,b) (((a) > (b)) ? (a) : (b))
#endif
#ifndef min
#define min(a,b) (((a) < (b)) ? (a) : (b))
#endif
#endif /* NOMINMAX */
/* Types use for passing & returning polymorphic values */
typedef UINT WPARAM;
typedef LONG LPARAM;
typedef LONG LRESULT;
#define MAKELPARAM(low, high) ((LPARAM)MAKELONG(low, high))
#define MAKELRESULT(low, high) ((LRESULT)MAKELONG(low, high))
/****** Common pointer types ************************************************/
#ifndef NULL
#define NULL 0
#endif
typedef char NEAR* PSTR;
typedef char NEAR* NPSTR;
#define SZ char /* ;Internal */
typedef char FAR* LPSTR;
typedef const char FAR* LPCSTR;
typedef BYTE NEAR* PBYTE;
typedef BYTE FAR* LPBYTE;
typedef int NEAR* PINT;
typedef int FAR* LPINT;
typedef WORD NEAR* PWORD;
typedef WORD FAR* LPWORD;
typedef long NEAR* PLONG;
typedef long FAR* LPLONG;
typedef DWORD NEAR* PDWORD;
typedef DWORD FAR* LPDWORD;
typedef void FAR* LPVOID;
#define MAKELP(sel, off) ((void FAR*)MAKELONG((off), (sel)))
#define SELECTOROF(lp) HIWORD(lp)
#define OFFSETOF(lp) LOWORD(lp)
#define FIELDOFFSET(type, field) ((int)(&((type NEAR*)1)->field)-1)
/****** Common handle types *************************************************/
#ifdef STRICT
typedef const void NEAR* HANDLE;
#define DECLARE_HANDLE(name) struct name##__ { int unused; }; \
typedef const struct name##__ NEAR* name
#define DECLARE_HANDLE32(name) struct name##__ { int unused; }; \
typedef const struct name##__ FAR* name
#else /* STRICT */
typedef UINT HANDLE;
#define DECLARE_HANDLE(name) typedef UINT name
#define DECLARE_HANDLE32(name) typedef DWORD name
#endif /* !STRICT */
typedef HANDLE* PHANDLE;
typedef HANDLE NEAR* SPHANDLE;
typedef HANDLE FAR* LPHANDLE;
typedef HANDLE HGLOBAL;
typedef HANDLE HLOCAL;
typedef HANDLE GLOBALHANDLE;
typedef HANDLE LOCALHANDLE;
typedef UINT ATOM;
#ifdef STRICT
typedef void (CALLBACK* FARPROC)(void);
typedef void (NEAR PASCAL* NEARPROC)(void);
#else
typedef int (CALLBACK* FARPROC)();
typedef int (NEAR PASCAL* NEARPROC)();
#endif
DECLARE_HANDLE(HSTR);
/****** KERNEL typedefs, structures, and functions **************************/
DECLARE_HANDLE(HINSTANCE);
typedef HINSTANCE HMODULE; /* HMODULEs can be used in place of HINSTANCEs */
#ifndef NOKERNEL
/****** Application entry point function ************************************/
#ifdef STRICT
int PASCAL WinMain(HINSTANCE, HINSTANCE, LPSTR, int);
#endif
/****** System Information **************************************************/
DWORD WINAPI GetVersion(void);
DWORD WINAPI GetFreeSpace(UINT);
UINT WINAPI GetCurrentPDB(void);
UINT WINAPI GetWindowsDirectory(LPSTR, UINT);
UINT WINAPI GetSystemDirectory(LPSTR, UINT);
#if (WINVER >= 0x030a)
UINT WINAPI GetFreeSystemResources(UINT);
#define GFSR_SYSTEMRESOURCES 0x0000
#define GFSR_GDIRESOURCES 0x0001
#define GFSR_USERRESOURCES 0x0002
#define GFSR_VALID 0x0002 /* ;Internal */
#endif /* WINVER >= 0x030a */
DWORD WINAPI GetWinFlags(void);
#define WF_PMODE 0x0001
#define WF_CPU286 0x0002
#define WF_CPU386 0x0004
#define WF_CPU486 0x0008
#define WF_STANDARD 0x0010
#define WF_WIN286 0x0010
#define WF_ENHANCED 0x0020
#define WF_WIN386 0x0020
#define WF_CPU086 0x0040
#define WF_CPU186 0x0080
#define WF_LARGEFRAME 0x0100
#define WF_SMALLFRAME 0x0200
#define WF_80x87 0x0400
#define WF_PAGING 0x0800
#define WF_WLO 0x8000
LPSTR WINAPI GetDOSEnvironment(void);
DWORD WINAPI GetCurrentTime(void);
DWORD WINAPI GetTickCount(void);
DWORD WINAPI GetTimerResolution(void);
/****** Error handling ******************************************************/
#if (WINVER >= 0x030a)
#ifndef NOLOGERROR
void WINAPI LogError(UINT err, void FAR* lpInfo);
void WINAPI LogParamError(UINT err, FARPROC lpfn, void FAR* param);
/****** LogParamError/LogError values */
/* Error modifier bits */
#define ERR_WARNING 0x8000
#define ERR_PARAM 0x4000
/* Internal error value masks */ /* ;Internal */
#define ERR_TYPE_MASK 0x0fff /* ;Internal */
#define ERR_FLAGS_MASK 0xc000 /* ;Internal */
/* ;Internal */
#define ERR_SIZE_MASK 0x3000
#define ERR_SIZE_SHIFT 12 /* ;Internal */
#define ERR_BYTE 0x1000
#define ERR_WORD 0x2000
#define ERR_DWORD 0x3000
/* ;Internal */
/* Error option flags (set by [kernel] ErrorOptions win.ini variable) *//* ;Internal */
/* ;Internal */
#define ERO_PARAM_ERROR_BREAK 0x0001 /* ;Internal */
#define ERO_BUFFER_FILL 0x0002 /* ;Internal */
/****** LogParamError() values */
/* Generic parameter values */
#define ERR_BAD_VALUE 0x6001
#define ERR_BAD_FLAGS 0x6002
#define ERR_BAD_INDEX 0x6003
#define ERR_BAD_DVALUE 0x7004
#define ERR_BAD_DFLAGS 0x7005
#define ERR_BAD_DINDEX 0x7006
#define ERR_BAD_PTR 0x7007
#define ERR_BAD_FUNC_PTR 0x7008
#define ERR_BAD_SELECTOR 0x6009
#define ERR_BAD_STRING_PTR 0x700a
#define ERR_BAD_HANDLE 0x600b
/* KERNEL parameter errors */
#define ERR_BAD_HINSTANCE 0x6020
#define ERR_BAD_HMODULE 0x6021
#define ERR_BAD_GLOBAL_HANDLE 0x6022
#define ERR_BAD_LOCAL_HANDLE 0x6023
#define ERR_BAD_ATOM 0x6024
#define ERR_BAD_HFILE 0x6025
/* USER parameter errors */
#define ERR_BAD_HWND 0x6040
#define ERR_BAD_HMENU 0x6041
#define ERR_BAD_HCURSOR 0x6042
#define ERR_BAD_HICON 0x6043
#define ERR_BAD_HDWP 0x6044
#define ERR_BAD_CID 0x6045
#define ERR_BAD_HDRVR 0x6046
/* GDI parameter errors */
#define ERR_BAD_COORDS 0x7060
#define ERR_BAD_GDI_OBJECT 0x6061
#define ERR_BAD_HDC 0x6062
#define ERR_BAD_HPEN 0x6063
#define ERR_BAD_HFONT 0x6064
#define ERR_BAD_HBRUSH 0x6065
#define ERR_BAD_HBITMAP 0x6066
#define ERR_BAD_HRGN 0x6067
#define ERR_BAD_HPALETTE 0x6068
#define ERR_BAD_HMETAFILE 0x6069
/* Debug fill constants */ /* ;Internal */
/* ;Internal */
#define DBGFILL_ALLOC 0xfd /* ;Internal */
#define DBGFILL_FREE 0xfb /* ;Internal */
#define DBGFILL_BUFFER 0xf9 /* ;Internal */
#define DBGFILL_STACK 0xf7 /* ;Internal */
/**** LogError() values */
/* KERNEL errors */
#define ERR_GALLOC 0x0001
#define ERR_GREALLOC 0x0002
#define ERR_GLOCK 0x0003
#define ERR_LALLOC 0x0004
#define ERR_LREALLOC 0x0005
#define ERR_LLOCK 0x0006
#define ERR_ALLOCRES 0x0007
#define ERR_LOCKRES 0x0008
#define ERR_LOADMODULE 0x0009
/* USER errors */
#define ERR_CREATEDLG 0x0040
#define ERR_CREATEDLG2 0x0041
#define ERR_REGISTERCLASS 0x0042
#define ERR_DCBUSY 0x0043
#define ERR_CREATEWND 0x0044
#define ERR_STRUCEXTRA 0x0045
#define ERR_LOADSTR 0x0046
#define ERR_LOADMENU 0x0047
#define ERR_NESTEDBEGINPAINT 0x0048
#define ERR_BADINDEX 0x0049
#define ERR_CREATEMENU 0x004a
/* GDI errors */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -