comparison win32/windef.d @ 1:4a9dcbd9e54f

-files of 0.13 beta -fixes so that it now compiles with the current dmd version
author marton@basel.hu
date Tue, 05 Apr 2011 20:44:01 +0200
parents
children
comparison
equal deleted inserted replaced
0:586e4a649642 1:4a9dcbd9e54f
1 /***********************************************************************\
2 * windef.d *
3 * *
4 * Windows API header module *
5 * *
6 * Translated from MinGW Windows headers *
7 * by Stewart Gordon *
8 * *
9 * Placed into public domain *
10 \***********************************************************************/
11 module win32.windef;
12
13 public import win32.winnt;
14 private import win32.w32api;
15
16 const size_t MAX_PATH = 260;
17
18 ushort MAKEWORD(ubyte a, ubyte b) {
19 return cast(ushort) ((b << 8) | a);
20 }
21
22 uint MAKELONG(ushort a, ushort b) {
23 return cast(uint) ((b << 16) | a);
24 }
25
26 ushort LOWORD(uint l) {
27 return cast(ushort) l;
28 }
29
30 ushort HIWORD(uint l) {
31 return cast(ushort) (l >>> 16);
32 }
33
34 ubyte LOBYTE(ushort w) {
35 return cast(ubyte) w;
36 }
37
38 ubyte HIBYTE(ushort w) {
39 return cast(ubyte) (w >>> 8);
40 }
41
42 template max(T) {
43 T max(T a, T b) {
44 return a > b ? a : b;
45 }
46 }
47
48 template min(T) {
49 T min(T a, T b) {
50 return a < b ? a : b;
51 }
52 }
53
54 const void* NULL = null;
55 alias ubyte BYTE;
56 alias ubyte* PBYTE, LPBYTE;
57 alias ushort USHORT, WORD, ATOM;
58 alias ushort* PUSHORT, PWORD, LPWORD;
59 alias uint ULONG, DWORD, UINT, COLORREF;
60 alias uint* PULONG, PDWORD, LPDWORD, PUINT, LPUINT;
61 alias int WINBOOL, BOOL, INT, LONG, HFILE, HRESULT;
62 alias int* PWINBOOL, LPWINBOOL, PBOOL, LPBOOL, PINT, LPINT, LPLONG;
63 alias float FLOAT;
64 alias float* PFLOAT;
65 alias void* PCVOID, LPCVOID;
66
67 alias UINT_PTR WPARAM;
68 alias LONG_PTR LPARAM, LRESULT;
69
70 alias HANDLE HGLOBAL, HLOCAL, GLOBALHANDLE, LOCALHANDLE, HGDIOBJ, HACCEL,
71 HBITMAP, HBRUSH, HCOLORSPACE, HDC, HGLRC, HDESK, HENHMETAFILE, HFONT,
72 HICON, HINSTANCE, HKEY, HMENU, HMETAFILE, HMODULE, HMONITOR, HPALETTE, HPEN,
73 HRGN, HRSRC, HSTR, HTASK, HWND, HWINSTA, HKL, HCURSOR;
74 alias HANDLE* PHKEY;
75
76 static if (WINVER >= 0x500) {
77 alias HANDLE HTERMINAL, HWINEVENTHOOK;
78 }
79
80 alias extern (Windows) int function() FARPROC, NEARPROC, PROC;
81
82 struct RECT {
83 LONG left;
84 LONG top;
85 LONG right;
86 LONG bottom;
87 }
88 alias RECT RECTL;
89 alias RECT* PRECT, LPRECT, LPCRECT, PRECTL, LPRECTL, LPCRECTL;
90
91 struct POINT {
92 LONG x;
93 LONG y;
94 }
95 alias POINT POINTL;
96 alias POINT* PPOINT, LPPOINT, PPOINTL, LPPOINTL;
97
98 struct SIZE {
99 LONG cx;
100 LONG cy;
101 }
102 alias SIZE SIZEL;
103 alias SIZE* PSIZE, LPSIZE, PSIZEL, LPSIZEL;
104
105 struct POINTS {
106 SHORT x;
107 SHORT y;
108 }
109 alias POINTS* PPOINTS, LPPOINTS;
110
111 enum : BOOL {
112 FALSE = 0,
113 TRUE = 1
114 }