comparison dynamin/c/windows_windef.d @ 0:aa4efef0f0b1

Initial commit of code.
author Jordan Miner <jminer7@gmail.com>
date Mon, 15 Jun 2009 22:10:48 -0500
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:aa4efef0f0b1
1 // Written in the D programming language
2 // www.digitalmars.com/d/
3
4 /*
5 * Translated from MinGW Windows headers as part of the WindowsAPI project:
6 * http://www.dsource.org/projects/bindings/wiki/WindowsApi
7 *
8 * by Stewart Gordon
9 * Placed into public domain
10 */
11
12 module dynamin.c.windows_windef;
13
14 public import dynamin.c.windows_winnt;
15 private import win32.w32api;
16
17 const size_t MAX_PATH = 260;
18
19 ushort MAKEWORD(ubyte a, ubyte b) {
20 return cast(ushort) ((b << 8) | a);
21 }
22
23 uint MAKELONG(ushort a, ushort b) {
24 return cast(uint) ((b << 16) | a);
25 }
26
27 ushort LOWORD(uint l) {
28 return cast(ushort) l;
29 }
30
31 ushort HIWORD(uint l) {
32 return cast(ushort) (l >>> 16);
33 }
34
35 ubyte LOBYTE(ushort w) {
36 return cast(ubyte) w;
37 }
38
39 ubyte HIBYTE(ushort w) {
40 return cast(ubyte) (w >>> 8);
41 }
42
43 template max(T) {
44 T max(T a, T b) {
45 return a > b ? a : b;
46 }
47 }
48
49 template min(T) {
50 T min(T a, T b) {
51 return a < b ? a : b;
52 }
53 }
54
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 }