WinDef.h
上传用户:dzyhzl
上传日期:2019-04-29
资源大小:56270k
文件大小:9k
源码类别:

模拟服务器

开发平台:

C/C++

  1. /****************************************************************************
  2. *                                                                           *
  3. * windef.h -- Basic Windows Type Definitions                                *
  4. *                                                                           *
  5. * Copyright (c) Microsoft Corporation. All rights reserved.                 *
  6. *                                                                           *
  7. ****************************************************************************/
  8. #ifndef _WINDEF_
  9. #define _WINDEF_
  10. #ifndef NO_STRICT
  11. #ifndef STRICT
  12. #define STRICT 1
  13. #endif
  14. #endif /* NO_STRICT */
  15. // Win32 defines _WIN32 automatically,
  16. // but Macintosh doesn't, so if we are using
  17. // Win32 Functions, we must do it here
  18. #ifdef _MAC
  19. #ifndef _WIN32
  20. #define _WIN32
  21. #endif
  22. #endif //_MAC
  23. #ifdef __cplusplus
  24. extern "C" {
  25. #endif
  26. #ifndef WINVER
  27. #define WINVER 0x0500
  28. #endif /* WINVER */
  29. /*
  30.  * BASETYPES is defined in ntdef.h if these types are already defined
  31.  */
  32. #ifndef BASETYPES
  33. #define BASETYPES
  34. typedef unsigned long ULONG;
  35. typedef ULONG *PULONG;
  36. typedef unsigned short USHORT;
  37. typedef USHORT *PUSHORT;
  38. typedef unsigned char UCHAR;
  39. typedef UCHAR *PUCHAR;
  40. typedef char *PSZ;
  41. #endif  /* !BASETYPES */
  42. #define MAX_PATH          260
  43. #ifndef NULL
  44. #ifdef __cplusplus
  45. #define NULL    0
  46. #else
  47. #define NULL    ((void *)0)
  48. #endif
  49. #endif
  50. #ifndef FALSE
  51. #define FALSE               0
  52. #endif
  53. #ifndef TRUE
  54. #define TRUE                1
  55. #endif
  56. #ifndef IN
  57. #define IN
  58. #endif
  59. #ifndef OUT
  60. #define OUT
  61. #endif
  62. #ifndef OPTIONAL
  63. #define OPTIONAL
  64. #endif
  65. #undef far
  66. #undef near
  67. #undef pascal
  68. #define far
  69. #define near
  70. #if (!defined(_MAC)) && ((_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED))
  71. #define pascal __stdcall
  72. #else
  73. #define pascal
  74. #endif
  75. #if defined(DOSWIN32) || defined(_MAC)
  76. #define cdecl _cdecl
  77. #ifndef CDECL
  78. #define CDECL _cdecl
  79. #endif
  80. #else
  81. #define cdecl
  82. #ifndef CDECL
  83. #define CDECL
  84. #endif
  85. #endif
  86. #ifdef _MAC
  87. #define CALLBACK    PASCAL
  88. #define WINAPI      CDECL
  89. #define WINAPIV     CDECL
  90. #define APIENTRY    WINAPI
  91. #define APIPRIVATE  CDECL
  92. #ifdef _68K_
  93. #define PASCAL      __pascal
  94. #else
  95. #define PASCAL
  96. #endif
  97. #elif (_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED)
  98. #define CALLBACK    __stdcall
  99. #define WINAPI      __stdcall
  100. #define WINAPIV     __cdecl
  101. #define APIENTRY    WINAPI
  102. #define APIPRIVATE  __stdcall
  103. #define PASCAL      __stdcall
  104. #else
  105. #define CALLBACK
  106. #define WINAPI
  107. #define WINAPIV
  108. #define APIENTRY    WINAPI
  109. #define APIPRIVATE
  110. #define PASCAL      pascal
  111. #endif
  112. #undef FAR
  113. #undef  NEAR
  114. #define FAR                 far
  115. #define NEAR                near
  116. #ifndef CONST
  117. #define CONST               const
  118. #endif
  119. typedef unsigned long       DWORD;
  120. typedef int                 BOOL;
  121. typedef unsigned char       BYTE;
  122. typedef unsigned short      WORD;
  123. typedef float               FLOAT;
  124. typedef FLOAT               *PFLOAT;
  125. typedef BOOL near           *PBOOL;
  126. typedef BOOL far            *LPBOOL;
  127. typedef BYTE near           *PBYTE;
  128. typedef BYTE far            *LPBYTE;
  129. typedef int near            *PINT;
  130. typedef int far             *LPINT;
  131. typedef WORD near           *PWORD;
  132. typedef WORD far            *LPWORD;
  133. typedef long far            *LPLONG;
  134. typedef DWORD near          *PDWORD;
  135. typedef DWORD far           *LPDWORD;
  136. typedef void far            *LPVOID;
  137. typedef CONST void far      *LPCVOID;
  138. typedef int                 INT;
  139. typedef unsigned int        UINT;
  140. typedef unsigned int        *PUINT;
  141. #ifndef NT_INCLUDED
  142. #include <winnt.h>
  143. #endif /* NT_INCLUDED */
  144. /* Types use for passing & returning polymorphic values */
  145. typedef UINT_PTR            WPARAM;
  146. typedef LONG_PTR            LPARAM;
  147. typedef LONG_PTR            LRESULT;
  148. #ifndef NOMINMAX
  149. #ifndef max
  150. #define max(a,b)            (((a) > (b)) ? (a) : (b))
  151. #endif
  152. #ifndef min
  153. #define min(a,b)            (((a) < (b)) ? (a) : (b))
  154. #endif
  155. #endif  /* NOMINMAX */
  156. #define MAKEWORD(a, b)      ((WORD)(((BYTE)((DWORD_PTR)(a) & 0xff)) | ((WORD)((BYTE)((DWORD_PTR)(b) & 0xff))) << 8))
  157. #define MAKELONG(a, b)      ((LONG)(((WORD)((DWORD_PTR)(a) & 0xffff)) | ((DWORD)((WORD)((DWORD_PTR)(b) & 0xffff))) << 16))
  158. #define LOWORD(l)           ((WORD)((DWORD_PTR)(l) & 0xffff))
  159. #define HIWORD(l)           ((WORD)((DWORD_PTR)(l) >> 16))
  160. #define LOBYTE(w)           ((BYTE)((DWORD_PTR)(w) & 0xff))
  161. #define HIBYTE(w)           ((BYTE)((DWORD_PTR)(w) >> 8))
  162. #ifndef WIN_INTERNAL
  163. DECLARE_HANDLE            (HWND);
  164. DECLARE_HANDLE            (HHOOK);
  165. #ifdef WINABLE
  166. DECLARE_HANDLE            (HEVENT);
  167. #endif
  168. #endif
  169. typedef WORD                ATOM;
  170. typedef HANDLE NEAR         *SPHANDLE;
  171. typedef HANDLE FAR          *LPHANDLE;
  172. typedef HANDLE              HGLOBAL;
  173. typedef HANDLE              HLOCAL;
  174. typedef HANDLE              GLOBALHANDLE;
  175. typedef HANDLE              LOCALHANDLE;
  176. #ifndef _MAC
  177. #ifdef _WIN64
  178. typedef INT_PTR (FAR WINAPI *FARPROC)();
  179. typedef INT_PTR (NEAR WINAPI *NEARPROC)();
  180. typedef INT_PTR (WINAPI *PROC)();
  181. #else
  182. typedef int (FAR WINAPI *FARPROC)();
  183. typedef int (NEAR WINAPI *NEARPROC)();
  184. typedef int (WINAPI *PROC)();
  185. #endif  // _WIN64
  186. #else
  187. typedef int (CALLBACK *FARPROC)();
  188. typedef int (CALLBACK *NEARPROC)();
  189. typedef int (CALLBACK *PROC)();
  190. #endif
  191. #if !defined(_MAC) || !defined(GDI_INTERNAL)
  192. #ifdef STRICT
  193. typedef void NEAR* HGDIOBJ;
  194. #else
  195. DECLARE_HANDLE(HGDIOBJ);
  196. #endif
  197. #endif
  198. DECLARE_HANDLE(HKEY);
  199. typedef HKEY *PHKEY;
  200. #if !defined(_MAC) || !defined(WIN_INTERNAL)
  201. DECLARE_HANDLE(HACCEL);
  202. #endif
  203. #if !defined(_MAC) || !defined(GDI_INTERNAL)
  204. DECLARE_HANDLE(HBITMAP);
  205. DECLARE_HANDLE(HBRUSH);
  206. #endif
  207. #if(WINVER >= 0x0400)
  208. DECLARE_HANDLE(HCOLORSPACE);
  209. #endif /* WINVER >= 0x0400 */
  210. #if !defined(_MAC) || !defined(GDI_INTERNAL)
  211. DECLARE_HANDLE(HDC);
  212. #endif
  213. DECLARE_HANDLE(HGLRC);          // OpenGL
  214. DECLARE_HANDLE(HDESK);
  215. DECLARE_HANDLE(HENHMETAFILE);
  216. #if !defined(_MAC) || !defined(GDI_INTERNAL)
  217. DECLARE_HANDLE(HFONT);
  218. #endif
  219. DECLARE_HANDLE(HICON);
  220. #if !defined(_MAC) || !defined(WIN_INTERNAL)
  221. DECLARE_HANDLE(HMENU);
  222. #endif
  223. DECLARE_HANDLE(HMETAFILE);
  224. DECLARE_HANDLE(HINSTANCE);
  225. typedef HINSTANCE HMODULE;      /* HMODULEs can be used in place of HINSTANCEs */
  226. #if !defined(_MAC) || !defined(GDI_INTERNAL)
  227. DECLARE_HANDLE(HPALETTE);
  228. DECLARE_HANDLE(HPEN);
  229. #endif
  230. DECLARE_HANDLE(HRGN);
  231. DECLARE_HANDLE(HRSRC);
  232. DECLARE_HANDLE(HSTR);
  233. DECLARE_HANDLE(HTASK);
  234. DECLARE_HANDLE(HWINSTA);
  235. DECLARE_HANDLE(HKL);
  236. #if(WINVER >= 0x0500)
  237. #ifndef _MAC
  238. DECLARE_HANDLE(HMONITOR);
  239. DECLARE_HANDLE(HWINEVENTHOOK);
  240. #endif
  241. DECLARE_HANDLE(HUMPD);
  242. #endif /* WINVER >= 0x0500 */
  243. #ifndef _MAC
  244. typedef int HFILE;
  245. typedef HICON HCURSOR;      /* HICONs & HCURSORs are polymorphic */
  246. #else
  247. typedef short HFILE;
  248. DECLARE_HANDLE(HCURSOR);    /* HICONs & HCURSORs are not polymorphic */
  249. #endif
  250. typedef DWORD   COLORREF;
  251. typedef DWORD   *LPCOLORREF;
  252. #define HFILE_ERROR ((HFILE)-1)
  253. typedef struct tagRECT
  254. {
  255.     LONG    left;
  256.     LONG    top;
  257.     LONG    right;
  258.     LONG    bottom;
  259. } RECT, *PRECT, NEAR *NPRECT, FAR *LPRECT;
  260. typedef const RECT FAR* LPCRECT;
  261. typedef struct _RECTL       /* rcl */
  262. {
  263.     LONG    left;
  264.     LONG    top;
  265.     LONG    right;
  266.     LONG    bottom;
  267. } RECTL, *PRECTL, *LPRECTL;
  268. typedef const RECTL FAR* LPCRECTL;
  269. typedef struct tagPOINT
  270. {
  271.     LONG  x;
  272.     LONG  y;
  273. } POINT, *PPOINT, NEAR *NPPOINT, FAR *LPPOINT;
  274. typedef struct _POINTL      /* ptl  */
  275. {
  276.     LONG  x;
  277.     LONG  y;
  278. } POINTL, *PPOINTL;
  279. typedef struct tagSIZE
  280. {
  281.     LONG        cx;
  282.     LONG        cy;
  283. } SIZE, *PSIZE, *LPSIZE;
  284. typedef SIZE               SIZEL;
  285. typedef SIZE               *PSIZEL, *LPSIZEL;
  286. typedef struct tagPOINTS
  287. {
  288. #ifndef _MAC
  289.     SHORT   x;
  290.     SHORT   y;
  291. #else
  292.     SHORT   y;
  293.     SHORT   x;
  294. #endif
  295. } POINTS, *PPOINTS, *LPPOINTS;
  296. /* mode selections for the device mode function */
  297. #define DM_UPDATE           1
  298. #define DM_COPY             2
  299. #define DM_PROMPT           4
  300. #define DM_MODIFY           8
  301. #define DM_IN_BUFFER        DM_MODIFY
  302. #define DM_IN_PROMPT        DM_PROMPT
  303. #define DM_OUT_BUFFER       DM_COPY
  304. #define DM_OUT_DEFAULT      DM_UPDATE
  305. /* device capabilities indices */
  306. #define DC_FIELDS           1
  307. #define DC_PAPERS           2
  308. #define DC_PAPERSIZE        3
  309. #define DC_MINEXTENT        4
  310. #define DC_MAXEXTENT        5
  311. #define DC_BINS             6
  312. #define DC_DUPLEX           7
  313. #define DC_SIZE             8
  314. #define DC_EXTRA            9
  315. #define DC_VERSION          10
  316. #define DC_DRIVER           11
  317. #define DC_BINNAMES         12
  318. #define DC_ENUMRESOLUTIONS  13
  319. #define DC_FILEDEPENDENCIES 14
  320. #define DC_TRUETYPE         15
  321. #define DC_PAPERNAMES       16
  322. #define DC_ORIENTATION      17
  323. #define DC_COPIES           18
  324. #ifdef __cplusplus
  325. }
  326. #endif
  327. #endif /* _WINDEF_ */