home *** CD-ROM | disk | FTP | other *** search
/ Power GUI Programming with VisualAge C++ / powergui.iso / trialva / ibmcppw / sdk / winh / windef.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-07-11  |  7.0 KB  |  307 lines

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