WinDef.h 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385
  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. #include <specstrings.h>
  145. /* Types use for passing & returning polymorphic values */
  146. typedef UINT_PTR WPARAM;
  147. typedef LONG_PTR LPARAM;
  148. typedef LONG_PTR LRESULT;
  149. #ifndef NOMINMAX
  150. #ifndef max
  151. #define max(a,b) (((a) > (b)) ? (a) : (b))
  152. #endif
  153. #ifndef min
  154. #define min(a,b) (((a) < (b)) ? (a) : (b))
  155. #endif
  156. #endif /* NOMINMAX */
  157. #define MAKEWORD(a, b) ((WORD)(((BYTE)((DWORD_PTR)(a) & 0xff)) | ((WORD)((BYTE)((DWORD_PTR)(b) & 0xff))) << 8))
  158. #define MAKELONG(a, b) ((LONG)(((WORD)((DWORD_PTR)(a) & 0xffff)) | ((DWORD)((WORD)((DWORD_PTR)(b) & 0xffff))) << 16))
  159. #define LOWORD(l) ((WORD)((DWORD_PTR)(l) & 0xffff))
  160. #define HIWORD(l) ((WORD)((DWORD_PTR)(l) >> 16))
  161. #define LOBYTE(w) ((BYTE)((DWORD_PTR)(w) & 0xff))
  162. #define HIBYTE(w) ((BYTE)((DWORD_PTR)(w) >> 8))
  163. #ifndef WIN_INTERNAL
  164. DECLARE_HANDLE (HWND);
  165. DECLARE_HANDLE (HHOOK);
  166. #ifdef WINABLE
  167. DECLARE_HANDLE (HEVENT);
  168. #endif
  169. #endif
  170. typedef WORD ATOM;
  171. typedef HANDLE NEAR *SPHANDLE;
  172. typedef HANDLE FAR *LPHANDLE;
  173. typedef HANDLE HGLOBAL;
  174. typedef HANDLE HLOCAL;
  175. typedef HANDLE GLOBALHANDLE;
  176. typedef HANDLE LOCALHANDLE;
  177. #ifndef _MAC
  178. #ifdef _WIN64
  179. typedef INT_PTR (FAR WINAPI *FARPROC)();
  180. typedef INT_PTR (NEAR WINAPI *NEARPROC)();
  181. typedef INT_PTR (WINAPI *PROC)();
  182. #else
  183. typedef int (FAR WINAPI *FARPROC)();
  184. typedef int (NEAR WINAPI *NEARPROC)();
  185. typedef int (WINAPI *PROC)();
  186. #endif // _WIN64
  187. #else
  188. typedef int (CALLBACK *FARPROC)();
  189. typedef int (CALLBACK *NEARPROC)();
  190. typedef int (CALLBACK *PROC)();
  191. #endif
  192. #if !defined(_MAC) || !defined(GDI_INTERNAL)
  193. #ifdef STRICT
  194. typedef void NEAR* HGDIOBJ;
  195. #else
  196. DECLARE_HANDLE(HGDIOBJ);
  197. #endif
  198. #endif
  199. DECLARE_HANDLE(HKEY);
  200. typedef HKEY *PHKEY;
  201. #if !defined(_MAC) || !defined(WIN_INTERNAL)
  202. DECLARE_HANDLE(HACCEL);
  203. #endif
  204. #if !defined(_MAC) || !defined(GDI_INTERNAL)
  205. DECLARE_HANDLE(HBITMAP);
  206. DECLARE_HANDLE(HBRUSH);
  207. #endif
  208. #if(WINVER >= 0x0400)
  209. DECLARE_HANDLE(HCOLORSPACE);
  210. #endif /* WINVER >= 0x0400 */
  211. #if !defined(_MAC) || !defined(GDI_INTERNAL)
  212. DECLARE_HANDLE(HDC);
  213. #endif
  214. DECLARE_HANDLE(HGLRC); // OpenGL
  215. DECLARE_HANDLE(HDESK);
  216. DECLARE_HANDLE(HENHMETAFILE);
  217. #if !defined(_MAC) || !defined(GDI_INTERNAL)
  218. DECLARE_HANDLE(HFONT);
  219. #endif
  220. DECLARE_HANDLE(HICON);
  221. #if !defined(_MAC) || !defined(WIN_INTERNAL)
  222. DECLARE_HANDLE(HMENU);
  223. #endif
  224. DECLARE_HANDLE(HMETAFILE);
  225. DECLARE_HANDLE(HINSTANCE);
  226. typedef HINSTANCE HMODULE; /* HMODULEs can be used in place of HINSTANCEs */
  227. #if !defined(_MAC) || !defined(GDI_INTERNAL)
  228. DECLARE_HANDLE(HPALETTE);
  229. DECLARE_HANDLE(HPEN);
  230. #endif
  231. DECLARE_HANDLE(HRGN);
  232. DECLARE_HANDLE(HRSRC);
  233. DECLARE_HANDLE(HSTR);
  234. DECLARE_HANDLE(HTASK);
  235. DECLARE_HANDLE(HWINSTA);
  236. DECLARE_HANDLE(HKL);
  237. #if(WINVER >= 0x0500)
  238. #ifndef _MAC
  239. DECLARE_HANDLE(HMONITOR);
  240. DECLARE_HANDLE(HWINEVENTHOOK);
  241. #endif
  242. DECLARE_HANDLE(HUMPD);
  243. #endif /* WINVER >= 0x0500 */
  244. #ifndef _MAC
  245. typedef int HFILE;
  246. typedef HICON HCURSOR; /* HICONs & HCURSORs are polymorphic */
  247. #else
  248. typedef short HFILE;
  249. DECLARE_HANDLE(HCURSOR); /* HICONs & HCURSORs are not polymorphic */
  250. #endif
  251. typedef DWORD COLORREF;
  252. typedef DWORD *LPCOLORREF;
  253. #define HFILE_ERROR ((HFILE)-1)
  254. typedef struct tagRECT
  255. {
  256. LONG left;
  257. LONG top;
  258. LONG right;
  259. LONG bottom;
  260. } RECT, *PRECT, NEAR *NPRECT, FAR *LPRECT;
  261. typedef const RECT FAR* LPCRECT;
  262. typedef struct _RECTL /* rcl */
  263. {
  264. LONG left;
  265. LONG top;
  266. LONG right;
  267. LONG bottom;
  268. } RECTL, *PRECTL, *LPRECTL;
  269. typedef const RECTL FAR* LPCRECTL;
  270. typedef struct tagPOINT
  271. {
  272. LONG x;
  273. LONG y;
  274. } POINT, *PPOINT, NEAR *NPPOINT, FAR *LPPOINT;
  275. typedef struct _POINTL /* ptl */
  276. {
  277. LONG x;
  278. LONG y;
  279. } POINTL, *PPOINTL;
  280. typedef struct tagSIZE
  281. {
  282. LONG cx;
  283. LONG cy;
  284. } SIZE, *PSIZE, *LPSIZE;
  285. typedef SIZE SIZEL;
  286. typedef SIZE *PSIZEL, *LPSIZEL;
  287. typedef struct tagPOINTS
  288. {
  289. #ifndef _MAC
  290. SHORT x;
  291. SHORT y;
  292. #else
  293. SHORT y;
  294. SHORT x;
  295. #endif
  296. } POINTS, *PPOINTS, *LPPOINTS;
  297. /* mode selections for the device mode function */
  298. #define DM_UPDATE 1
  299. #define DM_COPY 2
  300. #define DM_PROMPT 4
  301. #define DM_MODIFY 8
  302. #define DM_IN_BUFFER DM_MODIFY
  303. #define DM_IN_PROMPT DM_PROMPT
  304. #define DM_OUT_BUFFER DM_COPY
  305. #define DM_OUT_DEFAULT DM_UPDATE
  306. /* device capabilities indices */
  307. #define DC_FIELDS 1
  308. #define DC_PAPERS 2
  309. #define DC_PAPERSIZE 3
  310. #define DC_MINEXTENT 4
  311. #define DC_MAXEXTENT 5
  312. #define DC_BINS 6
  313. #define DC_DUPLEX 7
  314. #define DC_SIZE 8
  315. #define DC_EXTRA 9
  316. #define DC_VERSION 10
  317. #define DC_DRIVER 11
  318. #define DC_BINNAMES 12
  319. #define DC_ENUMRESOLUTIONS 13
  320. #define DC_FILEDEPENDENCIES 14
  321. #define DC_TRUETYPE 15
  322. #define DC_PAPERNAMES 16
  323. #define DC_ORIENTATION 17
  324. #define DC_COPIES 18
  325. #ifdef __cplusplus
  326. }
  327. #endif
  328. #endif /* _WINDEF_ */