Diff

Not logged in

Differences From Artifact [ea907e90fcf49ce3]:

To Artifact [d85b79a6d3b758cc]:


1 + 2 +/***********************************************************************\ 3 +* windef.d * 4 +* * 5 +* Windows API header module * 6 +* * 7 +* Translated from MinGW Windows headers * 8 +* by Stewart Gordon * 9 +* * 10 +* Placed into public domain * 11 +\***********************************************************************/ 1 12 module win32.windef; 2 13 3 -// Translated from Microsoft Platform SDK August 2001 Edition 4 -// by Y.Tomino (demoonlit@inter7.jp) 14 +public import win32.winnt; 15 +private import win32.w32api; 16 + 17 +const size_t MAX_PATH = 260; 18 + 19 +ushort MAKEWORD(ubyte a, ubyte b) 20 +{ 21 + return cast(ushort) ((b << 8) | a); 22 +} 23 + 24 + 25 +uint MAKELONG(ushort a, ushort b) 26 +{ 27 + return cast(uint) ((b << 16) | a); 28 +} 29 + 30 + 31 +ushort LOWORD(uint l) 32 +{ 33 + return cast(ushort) l; 34 +} 35 + 36 + 37 +ushort HIWORD(uint l) 38 +{ 39 + return cast(ushort) (l >>> 16); 40 +} 41 + 42 + 43 +ubyte LOBYTE(ushort w) 44 +{ 45 + return cast(ubyte) w; 46 +} 47 + 48 + 49 +ubyte HIBYTE(ushort w) 50 +{ 51 + return cast(ubyte) (w >>> 8); 52 +} 53 + 54 + 55 +/+ template max(T) { 56 + T max(T a, T b) 57 + { 58 + return a > b ? a : b; 59 + } 60 +} 61 + 62 +template min(T) { 63 + T min(T a, T b) 64 + { 65 + return a < b ? a : b; 66 + } 67 +} +/ 68 + 69 +enum NULL = null; 70 +//~ alias null NULL; 71 +//~ const void *NULL = null; 72 +alias ubyte BYTE; 73 +alias ubyte *PBYTE, LPBYTE; 74 +alias ushort USHORT, WORD, ATOM; 75 +alias ushort*PUSHORT, PWORD, LPWORD; 76 +alias uint ULONG, DWORD, UINT, COLORREF; 77 +alias uint *PULONG, PDWORD, LPDWORD, PUINT, LPUINT; 78 +alias int WINBOOL, BOOL, INT, LONG, HFILE, HRESULT; 79 +alias int*PWINBOOL, LPWINBOOL, PBOOL, LPBOOL, PINT, LPINT, LPLONG; 80 +alias float FLOAT; 81 +alias float*PFLOAT; 82 +alias CPtr!(void) PCVOID, LPCVOID; 83 + 84 +alias UINT_PTR WPARAM; 85 +alias LONG_PTR LPARAM, LRESULT; 86 + 87 +alias HANDLE HGLOBAL, HLOCAL, GLOBALHANDLE, LOCALHANDLE, HGDIOBJ, HACCEL, 88 + HBITMAP, HBRUSH, HCOLORSPACE, HDC, HGLRC, HDESK, HENHMETAFILE, HFONT, 89 + HICON, HINSTANCE, HKEY, HMENU, HMETAFILE, HMODULE, HMONITOR, HPALETTE, HPEN, 90 + HRGN, HRSRC, HSTR, HTASK, HWND, HWINSTA, HKL, HCURSOR; 91 +alias HANDLE*PHKEY; 92 + 93 +static 94 + 95 +if (WINVER >= 0x500) 96 +{ 97 + alias HANDLE HTERMINAL, HWINEVENTHOOK; 98 +} 5 99 6 -alias void* va_list; 7 -alias long __int64; 8 -alias ulong DWORD64; 9 -alias uint SIZE_T; 10 -alias SIZE_T* PSIZE_T; 11 -alias int INT_PTR; 12 -alias uint UINT_PTR; 13 -alias uint LONG_PTR; 14 -alias uint ULONG_PTR; 15 -alias uint DWORD_PTR; 16 -alias DWORD_PTR* PDWORD_PTR; 17 -alias UINT_PTR* PUINT_PTR; 18 -alias ULONG_PTR* PULONG_PTR; 19 -enum : UINT { UINT_MAX = UINT.max } 100 +alias extern (Windows) int function() FARPROC, NEARPROC, PROC; 20 101 21 -// #ifndef _WINDEF_ 22 -// #define _WINDEF_ 23 - 24 -// #ifndef NO_STRICT 25 -// #ifndef STRICT 26 -// #... 27 -// #endif 28 -// #endif /* NO_STRICT */ 102 +struct RECT 103 +{ 104 + LONG left; 105 + LONG top; 106 + LONG right; 107 + LONG bottom; 108 +} 109 +alias RECT RECTL; 110 +alias RECT*PRECT, LPRECT, PRECTL, LPRECTL; 111 +alias CPtr!(RECT) LPCRECT, LPCRECTL; 29 112 30 -// #ifdef _MAC 31 -// #ifndef _WIN32 32 -// #... 33 -// #endif 34 -// #endif //_MAC 35 - 36 -// #ifdef __cplusplus 37 -// extern "C" { 38 -// #endif 39 - 40 -// #ifndef WINVER 41 -// #... 42 -// #endif /* WINVER */ 43 - 44 -// #ifndef BASETYPES 45 -// #define BASETYPES 46 -alias uint ULONG; 47 -alias ULONG* PULONG; 48 -alias ushort USHORT; 49 -alias USHORT* PUSHORT; 50 -alias ubyte UCHAR; 51 -alias UCHAR* PUCHAR; 52 -alias char* PSZ; 53 -// #endif /* !BASETYPES */ 113 +struct POINT 114 +{ 115 + LONG x; 116 + LONG y; 117 + alias x e1; 118 + alias y e2; 119 +} 120 +alias POINT POINTL; 121 +alias POINT*PPOINT, LPPOINT, PPOINTL, LPPOINTL; 54 122 55 -enum : uint { MAX_PATH = 260 } 56 - 57 -// #ifndef NULL 58 -// #ifdef __cplusplus 59 -const void* NULL = null; 60 -// #else 61 -// #... 62 -// #endif 63 -// #endif 64 - 65 -// #ifndef FALSE 66 -enum : uint { FALSE = 0 } 67 -// #endif 68 - 69 -// #ifndef TRUE 70 -enum : uint { TRUE = 1 } 71 -// #endif 72 - 73 -// #ifndef IN 74 -// #define IN 75 -// #endif 76 - 77 -// #ifndef OUT 78 -// #define OUT 79 -// #endif 123 +struct SIZE 124 +{ 125 + LONG cx; 126 + LONG cy; 127 +} 128 +alias SIZE SIZEL; 129 +alias SIZE*PSIZE, LPSIZE, PSIZEL, LPSIZEL; 80 130 81 -// #ifndef OPTIONAL 82 -// #define OPTIONAL 83 -// #endif 84 - 85 -// #undef far 86 -// #undef near 87 -// #undef pascal 88 - 89 -// #define far 90 -// #define near 91 -// #if (!defined(_MAC)) && ((_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED)) 92 -// #define pascal __stdcall 93 -// #else 94 -// #... 95 -// #endif 96 - 97 -// #if defined(DOSWIN32) || defined(_MAC) 98 -// #... 99 -// #ifndef CDECL 100 -// #... 101 -// #endif 102 -// #else 103 -// #define cdecl 104 -// #ifndef CDECL 105 -// #define CDECL 106 -// #endif 107 -// #endif 108 - 109 -// #ifdef _MAC 110 -// #... 111 -// #... 112 -// #... 113 -// #... 114 -// #... 115 -// #ifdef _68K_ 116 -// #... 117 -// #else 118 -// #... 119 -// #endif 120 -// #elif (_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED) 121 -// #define CALLBACK __stdcall 122 -// #define WINAPI __stdcall 123 -// #define WINAPIV __cdecl 124 -// #define APIENTRY WINAPI 125 -// #define APIPRIVATE __stdcall 126 -// #define PASCAL __stdcall 127 -// #else 128 -// #... 129 -// #... 130 -// #... 131 -// #... 132 -// #... 133 -// #... 134 -// #endif 135 - 136 -// #undef FAR 137 -// #undef NEAR 138 -// #define FAR far 139 -// #define NEAR near 140 -// #ifndef CONST 141 -// #define CONST const 142 -// #endif 131 +struct POINTS 132 +{ 133 + SHORT x; 134 + SHORT y; 135 +} 136 +alias POINTS*PPOINTS, LPPOINTS; 143 137 144 -alias uint DWORD; 145 -alias int BOOL; 146 -alias ubyte BYTE; 147 -alias ushort WORD; 148 -alias float FLOAT; 149 -alias FLOAT* PFLOAT; 150 -alias BOOL* PBOOL; 151 -alias BOOL* LPBOOL; 152 -alias BYTE* PBYTE; 153 -alias BYTE* LPBYTE; 154 -alias int* PINT; 155 -alias int* LPINT; 156 -alias WORD* PWORD; 157 -alias WORD* LPWORD; 158 -alias int* LPLONG; 159 -alias DWORD* PDWORD; 160 -alias DWORD* LPDWORD; 161 -alias void* LPVOID; 162 -alias void* LPCVOID; 163 - 164 -alias int INT; 165 -alias uint UINT; 166 -alias uint* PUINT; 167 - 168 -// #ifndef NT_INCLUDED 169 -import win32.winnt; 170 -// #endif /* NT_INCLUDED */ 171 - 172 -alias UINT_PTR WPARAM; 173 -alias LONG_PTR LPARAM; 174 -alias LONG_PTR LRESULT; 175 - 176 -// #ifndef NOMINMAX 177 - 178 -// #ifndef max 179 -int max(int a, int b){ return (a > b)? a : b; } 180 -uint max(uint a, uint b){ return (a > b)? a : b; } 181 -real max(real a, real b){ return (a > b)? a : b; } 182 -// #endif 183 - 184 -// #ifndef min 185 -int min(int a, int b){ return (a < b)? a : b; } 186 -uint min(uint a, uint b){ return (a < b)? a : b; } 187 -real min(real a, real b){ return (a < b)? a : b; } 188 -// #endif 189 - 190 -// #endif /* NOMINMAX */ 191 - 192 -ushort MAKEWORD(byte a, byte b){ return (a & 0xff) | ((b & 0xff) << 8); } 193 -uint MAKELONG(ushort a, ushort b){ return (a & 0xffff) | ((b & 0xffff) << 16); } 194 -ushort LOWORD(uint l){ return l & 0xffff; } 195 -ushort HIWORD(uint l){ return l >>> 16; } 196 -ubyte LOBYTE(ushort l){ return l & 0xff; } 197 -ubyte HIBYTE(ushort l){ return l >>> 8; } 198 - 199 -// #ifndef WIN_INTERNAL 200 -alias void* HWND; 201 -alias void* HHOOK; 202 -// #ifdef WINABLE 203 -// ... 204 -// #endif 205 -// #endif 206 - 207 -alias WORD ATOM; 208 - 209 -alias HANDLE* SPHANDLE; 210 -alias HANDLE* LPHANDLE; 211 -alias HANDLE HGLOBAL; 212 -alias HANDLE HLOCAL; 213 -alias HANDLE GLOBALHANDLE; 214 -alias HANDLE LOCALHANDLE; 215 -// #ifndef _MAC 216 -// #ifdef _WIN64 217 -// ... 218 -// #else 219 -extern(Windows) alias int function() FARPROC; 220 -extern(Windows) alias int function() NEARPROC; 221 -extern(Windows) alias int function() PROC; 222 -// #endif // _WIN64 223 -// #else 224 -// ... 225 -// #endif 226 - 227 -// #if !defined(_MAC) || !defined(GDI_INTERNAL) 228 -// #ifdef STRICT 229 -alias void* HGDIOBJ; 230 -// #else 231 -// ... 232 -// #endif 233 -// #endif 234 - 235 -alias void* HKEY; 236 -alias HKEY* PHKEY; 237 - 238 -// #if !defined(_MAC) || !defined(WIN_INTERNAL) 239 -alias void* HACCEL; 240 -// #endif 241 -// #if !defined(_MAC) || !defined(GDI_INTERNAL) 242 -alias void* HBITMAP; 243 -alias void* HBRUSH; 244 -// #endif 245 -// #if(WINVER >= 0x0400) 246 -alias void* HCOLORSPACE; 247 -// #endif /* WINVER >= 0x0400 */ 248 -// #if !defined(_MAC) || !defined(GDI_INTERNAL) 249 -alias void* HDC; 250 -// #endif 251 -alias void* HGLRC; 252 -alias void* HDESK; 253 -alias void* HENHMETAFILE; 254 -// #if !defined(_MAC) || !defined(GDI_INTERNAL) 255 -alias void* HFONT; 256 -// #endif 257 -alias void* HICON; 258 -// #if !defined(_MAC) || !defined(WIN_INTERNAL) 259 -alias void* HMENU; 260 -// #endif 261 -alias void* HMETAFILE; 262 -alias void* HINSTANCE; 263 -alias HINSTANCE HMODULE; 264 -// #if !defined(_MAC) || !defined(GDI_INTERNAL) 265 -alias void* HPALETTE; 266 -alias void* HPEN; 267 -// #endif 268 -alias void* HRGN; 269 -alias void* HRSRC; 270 -alias void* HSTR; 271 -alias void* HTASK; 272 -alias void* HWINSTA; 273 -alias void* HKL; 274 - 275 -// #if(WINVER >= 0x0500) 276 -// #ifndef _MAC 277 -alias void* HMONITOR; 278 -alias void* HWINEVENTHOOK; 279 -// #endif 280 -alias void* HUMPD; 281 -// #endif /* WINVER >= 0x0500 */ 282 - 283 -// #ifndef _MAC 284 -alias int HFILE; 285 -alias HICON HCURSOR; 286 -// #else 287 -// ... 288 -// #endif 289 - 290 -alias DWORD COLORREF; 291 -alias DWORD* LPCOLORREF; 292 - 293 -const HFILE HFILE_ERROR = -1; 294 - 295 -struct tagRECT { 296 - LONG left; 297 - LONG top; 298 - LONG right; 299 - LONG bottom; 300 -} 301 -alias tagRECT RECT; 302 -alias tagRECT* PRECT; 303 -alias tagRECT* NPRECT; 304 -alias tagRECT* LPRECT; 305 - 306 -alias RECT* LPCRECT; 307 - 308 -struct _RECTL { 309 - LONG left; 310 - LONG top; 311 - LONG right; 312 - LONG bottom; 313 -} 314 -alias _RECTL RECTL; 315 -alias _RECTL* PRECTL; 316 -alias _RECTL* LPRECTL; 317 - 318 -alias RECTL* LPCRECTL; 319 - 320 -struct tagPOINT { 321 - LONG x; 322 - LONG y; 323 -} 324 -alias tagPOINT POINT; 325 -alias tagPOINT* PPOINT; 326 -alias tagPOINT* NPPOINT; 327 -alias tagPOINT* LPPOINT; 328 - 329 -struct _POINTL { 330 - LONG x; 331 - LONG y; 332 -} 333 -alias _POINTL POINTL; 334 -alias _POINTL* PPOINTL; 335 - 336 -struct tagSIZE { 337 - LONG cx; 338 - LONG cy; 339 -} 340 -alias tagSIZE SIZE; 341 -alias tagSIZE* PSIZE; 342 -alias tagSIZE* LPSIZE; 343 - 344 -alias SIZE SIZEL; 345 -alias SIZE* PSIZEL; 346 -alias SIZE* LPSIZEL; 347 - 348 -struct tagPOINTS { 349 -// #ifndef _MAC 350 - SHORT x; 351 - SHORT y; 352 -// #else 353 -// ... 354 -// #endif 355 -} 356 -alias tagPOINTS POINTS; 357 -alias tagPOINTS* PPOINTS; 358 -alias tagPOINTS* LPPOINTS; 359 - 360 -enum : uint { DM_UPDATE = 1 } 361 -enum : uint { DM_COPY = 2 } 362 -enum : uint { DM_PROMPT = 4 } 363 -enum : uint { DM_MODIFY = 8 } 364 - 365 -alias DM_MODIFY DM_IN_BUFFER; 366 -alias DM_PROMPT DM_IN_PROMPT; 367 -alias DM_COPY DM_OUT_BUFFER; 368 -alias DM_UPDATE DM_OUT_DEFAULT; 369 - 370 -enum : uint { DC_FIELDS = 1 } 371 -enum : uint { DC_PAPERS = 2 } 372 -enum : uint { DC_PAPERSIZE = 3 } 373 -enum : uint { DC_MINEXTENT = 4 } 374 -enum : uint { DC_MAXEXTENT = 5 } 375 -enum : uint { DC_BINS = 6 } 376 -enum : uint { DC_DUPLEX = 7 } 377 -enum : uint { DC_SIZE = 8 } 378 -enum : uint { DC_EXTRA = 9 } 379 -enum : uint { DC_VERSION = 10 } 380 -enum : uint { DC_DRIVER = 11 } 381 -enum : uint { DC_BINNAMES = 12 } 382 -enum : uint { DC_ENUMRESOLUTIONS = 13 } 383 -enum : uint { DC_FILEDEPENDENCIES = 14 } 384 -enum : uint { DC_TRUETYPE = 15 } 385 -enum : uint { DC_PAPERNAMES = 16 } 386 -enum : uint { DC_ORIENTATION = 17 } 387 -enum : uint { DC_COPIES = 18 } 388 - 389 -// #ifdef __cplusplus 390 -// } 391 -// #endif 392 - 393 -// #endif /* _WINDEF_ */ 394 - 138 +enum : BOOL { 139 + FALSE = 0, 140 + TRUE = 1 141 +}