- Move "questions and comments" at the top of the document.
[wine/multimedia.git] / include / windef.h
blob65dd6765831369eb7027c2345dd9e6d8c8c7826c
1 /*
2 * Basic types definitions
4 * Copyright 1996 Alexandre Julliard
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #ifndef __WINE_WINDEF_H
22 #define __WINE_WINDEF_H
24 #ifdef __WINE__
25 # undef UNICODE
26 #endif /* __WINE__ */
28 #define WINVER 0x0500
30 #include "winnt.h"
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
38 /* Macros to map Winelib names to the correct implementation name */
39 /* depending on __WINE__ and UNICODE macros. */
40 /* Note that Winelib is purely Win32. */
42 #ifdef __WINE__
43 # define WINELIB_NAME_AW(func) \
44 func##_must_be_suffixed_with_W_or_A_in_this_context \
45 func##_must_be_suffixed_with_W_or_A_in_this_context
46 #else /* __WINE__ */
47 # ifdef UNICODE
48 # define WINELIB_NAME_AW(func) func##W
49 # else
50 # define WINELIB_NAME_AW(func) func##A
51 # endif /* UNICODE */
52 #endif /* __WINE__ */
54 #ifdef __WINE__
55 # define DECL_WINELIB_TYPE_AW(type) /* nothing */
56 #else /* __WINE__ */
57 # define DECL_WINELIB_TYPE_AW(type) typedef WINELIB_NAME_AW(type) type;
58 #endif /* __WINE__ */
61 /* Integer types */
62 typedef UINT WPARAM;
63 typedef LONG LPARAM;
64 typedef LONG LRESULT;
65 typedef WORD ATOM;
66 typedef WORD CATCHBUF[9];
67 typedef WORD *LPCATCHBUF;
68 typedef DWORD COLORREF, *LPCOLORREF;
71 /* Handle types that exist both in Win16 and Win32. */
73 typedef int HFILE;
74 DECLARE_OLD_HANDLE(HACCEL);
75 DECLARE_OLD_HANDLE(HBITMAP);
76 DECLARE_OLD_HANDLE(HBRUSH);
77 DECLARE_HANDLE(HCOLORSPACE);
78 DECLARE_OLD_HANDLE(HDC);
79 DECLARE_HANDLE(HDESK);
80 DECLARE_OLD_HANDLE(HENHMETAFILE);
81 DECLARE_OLD_HANDLE(HFONT);
82 DECLARE_OLD_HANDLE(HHOOK);
83 DECLARE_OLD_HANDLE(HICON);
84 DECLARE_OLD_HANDLE(HINSTANCE);
85 DECLARE_OLD_HANDLE(HKEY);
86 DECLARE_OLD_HANDLE(HKL);
87 DECLARE_OLD_HANDLE(HMENU);
88 DECLARE_OLD_HANDLE(HMETAFILE);
89 DECLARE_HANDLE(HMONITOR);
90 DECLARE_OLD_HANDLE(HPALETTE);
91 DECLARE_OLD_HANDLE(HPEN);
92 DECLARE_OLD_HANDLE(HRGN);
93 DECLARE_OLD_HANDLE(HRSRC);
94 DECLARE_OLD_HANDLE(HTASK);
95 DECLARE_HANDLE(HWINEVENTHOOK);
96 DECLARE_HANDLE(HWINSTA);
97 DECLARE_OLD_HANDLE(HWND);
99 /* Handle types that must remain interchangeable even with strict on */
101 typedef HINSTANCE HMODULE;
102 typedef HANDLE HGDIOBJ;
103 typedef HANDLE HGLOBAL;
104 typedef HANDLE HLOCAL;
105 typedef HANDLE GLOBALHANDLE;
106 typedef HANDLE LOCALHANDLE;
107 typedef HICON HCURSOR;
109 /* Callback function pointers types */
111 typedef INT (CALLBACK *FARPROC)();
112 typedef INT (CALLBACK *PROC)();
115 /* Macros to split words and longs. */
117 #define LOBYTE(w) ((BYTE)(WORD)(w))
118 #define HIBYTE(w) ((BYTE)((WORD)(w) >> 8))
120 #define LOWORD(l) ((WORD)(DWORD)(l))
121 #define HIWORD(l) ((WORD)((DWORD)(l) >> 16))
123 #define SLOWORD(l) ((SHORT)(LONG)(l))
124 #define SHIWORD(l) ((SHORT)((LONG)(l) >> 16))
126 #define MAKEWORD(low,high) ((WORD)(((BYTE)(low)) | ((WORD)((BYTE)(high))) << 8))
127 #define MAKELONG(low,high) ((LONG)(((WORD)(low)) | (((DWORD)((WORD)(high))) << 16)))
128 #define MAKELPARAM(low,high) ((LPARAM)MAKELONG(low,high))
129 #define MAKEWPARAM(low,high) ((WPARAM)MAKELONG(low,high))
130 #define MAKELRESULT(low,high) ((LRESULT)MAKELONG(low,high))
132 #define SELECTOROF(ptr) (HIWORD(ptr))
133 #define OFFSETOF(ptr) (LOWORD(ptr))
135 #ifdef __WINE__
136 /* macros to set parts of a DWORD (not in the Windows API) */
137 #define SET_LOWORD(dw,val) ((dw) = ((dw) & 0xffff0000) | LOWORD(val))
138 #define SET_LOBYTE(dw,val) ((dw) = ((dw) & 0xffffff00) | LOBYTE(val))
139 #define SET_HIBYTE(dw,val) ((dw) = ((dw) & 0xffff00ff) | (LOBYTE(val) << 8))
140 #define ADD_LOWORD(dw,val) ((dw) = ((dw) & 0xffff0000) | LOWORD((DWORD)(dw)+(val)))
141 #endif
143 /* min and max macros */
144 #ifndef NOMINMAX
145 #ifndef max
146 #define max(a,b) (((a) > (b)) ? (a) : (b))
147 #endif
148 #ifndef min
149 #define min(a,b) (((a) < (b)) ? (a) : (b))
150 #endif
151 #endif /* NOMINMAX */
153 #define MAX_PATH 260
154 #define HFILE_ERROR ((HFILE)-1)
156 /* The SIZE structure */
157 typedef struct tagSIZE
159 LONG cx;
160 LONG cy;
161 } SIZE, *PSIZE, *LPSIZE;
163 typedef SIZE SIZEL, *PSIZEL, *LPSIZEL;
165 /* The POINT structure */
166 typedef struct tagPOINT
168 LONG x;
169 LONG y;
170 } POINT, *PPOINT, *LPPOINT;
172 typedef struct _POINTL
174 LONG x;
175 LONG y;
176 } POINTL;
178 /* The POINTS structure */
180 typedef struct tagPOINTS
182 SHORT x;
183 SHORT y;
184 } POINTS, *PPOINTS, *LPPOINTS;
186 /* The RECT structure */
187 typedef struct tagRECT
189 INT left;
190 INT top;
191 INT right;
192 INT bottom;
193 } RECT, *PRECT, *LPRECT;
194 typedef const RECT *LPCRECT;
197 typedef struct tagRECTL
199 LONG left;
200 LONG top;
201 LONG right;
202 LONG bottom;
203 } RECTL, *PRECTL, *LPRECTL;
205 typedef const RECTL *LPCRECTL;
207 #ifdef __cplusplus
209 #endif
211 #endif /* __WINE_WINDEF_H */