home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / vc98 / include / windef.h < prev    next >
C/C++ Source or Header  |  1998-04-25  |  9KB  |  375 lines

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