Avoid list corruption when linking window with HWND_BOTTOM (thanks to
[wine/multimedia.git] / include / windef.h
blobb98a81da038ba5dc4332e6e5daa7c2c8b93ae4dd
1 /*
2 * Basic types definitions
4 * Copyright 1996 Alexandre Julliard
5 */
7 #ifndef __WINE_WINDEF_H
8 #define __WINE_WINDEF_H
10 #ifdef __WINE__
11 # undef UNICODE
12 #endif /* __WINE__ */
14 #define WINVER 0x0500
16 #include "winnt.h"
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
24 /* Macros to map Winelib names to the correct implementation name */
25 /* depending on __WINE__ and UNICODE macros. */
26 /* Note that Winelib is purely Win32. */
28 #ifdef __WINE__
29 # define WINELIB_NAME_AW(func) \
30 func##_must_be_suffixed_with_W_or_A_in_this_context \
31 func##_must_be_suffixed_with_W_or_A_in_this_context
32 #else /* __WINE__ */
33 # ifdef UNICODE
34 # define WINELIB_NAME_AW(func) func##W
35 # else
36 # define WINELIB_NAME_AW(func) func##A
37 # endif /* UNICODE */
38 #endif /* __WINE__ */
40 #ifdef __WINE__
41 # define DECL_WINELIB_TYPE_AW(type) /* nothing */
42 #else /* __WINE__ */
43 # define DECL_WINELIB_TYPE_AW(type) typedef WINELIB_NAME_AW(type) type;
44 #endif /* __WINE__ */
47 /* Integer types */
48 typedef UINT WPARAM;
49 typedef LONG LPARAM;
50 typedef LONG LRESULT;
51 typedef WORD ATOM;
52 typedef WORD CATCHBUF[9];
53 typedef WORD *LPCATCHBUF;
55 /* Handle types that exist both in Win16 and Win32. */
57 typedef int HFILE;
58 DECLARE_OLD_HANDLE(HACCEL);
59 DECLARE_OLD_HANDLE(HBITMAP);
60 DECLARE_OLD_HANDLE(HBRUSH);
61 DECLARE_HANDLE(HCOLORSPACE);
62 DECLARE_OLD_HANDLE(HDC);
63 DECLARE_HANDLE(HDESK);
64 DECLARE_OLD_HANDLE(HENHMETAFILE);
65 DECLARE_OLD_HANDLE(HFONT);
66 DECLARE_OLD_HANDLE(HHOOK);
67 DECLARE_OLD_HANDLE(HICON);
68 DECLARE_OLD_HANDLE(HINSTANCE);
69 DECLARE_OLD_HANDLE(HKEY);
70 DECLARE_OLD_HANDLE(HKL);
71 DECLARE_OLD_HANDLE(HMENU);
72 DECLARE_OLD_HANDLE(HMETAFILE);
73 DECLARE_OLD_HANDLE(HMONITOR);
74 DECLARE_OLD_HANDLE(HPALETTE);
75 DECLARE_OLD_HANDLE(HPEN);
76 DECLARE_OLD_HANDLE(HRGN);
77 DECLARE_OLD_HANDLE(HRSRC);
78 DECLARE_OLD_HANDLE(HTASK);
79 DECLARE_HANDLE(HWINSTA);
80 DECLARE_OLD_HANDLE(HWND);
82 /* Handle types that must remain interchangeable even with strict on */
84 typedef HINSTANCE HMODULE;
85 typedef HANDLE HGDIOBJ;
86 typedef HANDLE HGLOBAL;
87 typedef HANDLE HLOCAL;
88 typedef HANDLE GLOBALHANDLE;
89 typedef HANDLE LOCALHANDLE;
90 typedef HICON HCURSOR;
92 /* Callback function pointers types */
94 typedef INT CALLBACK (*FARPROC)();
95 typedef INT CALLBACK (*PROC)();
98 /* Macros to split words and longs. */
100 #define LOBYTE(w) ((BYTE)(WORD)(w))
101 #define HIBYTE(w) ((BYTE)((WORD)(w) >> 8))
103 #define LOWORD(l) ((WORD)(DWORD)(l))
104 #define HIWORD(l) ((WORD)((DWORD)(l) >> 16))
106 #define SLOWORD(l) ((SHORT)(LONG)(l))
107 #define SHIWORD(l) ((SHORT)((LONG)(l) >> 16))
109 #define MAKEWORD(low,high) ((WORD)(((BYTE)(low)) | ((WORD)((BYTE)(high))) << 8))
110 #define MAKELONG(low,high) ((LONG)(((WORD)(low)) | (((DWORD)((WORD)(high))) << 16)))
111 #define MAKELPARAM(low,high) ((LPARAM)MAKELONG(low,high))
112 #define MAKEWPARAM(low,high) ((WPARAM)MAKELONG(low,high))
113 #define MAKELRESULT(low,high) ((LRESULT)MAKELONG(low,high))
114 #define MAKEINTATOM(atom) ((LPCSTR)MAKELONG((atom),0))
116 #define SELECTOROF(ptr) (HIWORD(ptr))
117 #define OFFSETOF(ptr) (LOWORD(ptr))
119 #ifdef __WINE__
120 /* macros to set parts of a DWORD (not in the Windows API) */
121 #define SET_LOWORD(dw,val) ((dw) = ((dw) & 0xffff0000) | LOWORD(val))
122 #define SET_LOBYTE(dw,val) ((dw) = ((dw) & 0xffffff00) | LOBYTE(val))
123 #define SET_HIBYTE(dw,val) ((dw) = ((dw) & 0xffff00ff) | (LOBYTE(val) << 8))
124 #define ADD_LOWORD(dw,val) ((dw) = ((dw) & 0xffff0000) | LOWORD((DWORD)(dw)+(val)))
125 #endif
127 /* min and max macros */
128 #ifndef NOMINMAX
129 #ifndef max
130 #define max(a,b) (((a) > (b)) ? (a) : (b))
131 #endif
132 #ifndef min
133 #define min(a,b) (((a) < (b)) ? (a) : (b))
134 #endif
135 #endif /* NOMINMAX */
137 #ifndef _MAX_PATH
138 /* FIXME: These are supposed to be in stdlib.h only */
139 #define _MAX_DRIVE 3
140 #define _MAX_FNAME 256
141 #define _MAX_DIR _MAX_FNAME
142 #define _MAX_EXT _MAX_FNAME
143 #define _MAX_PATH 260
144 #endif
145 #define MAX_PATH _MAX_PATH
148 #define HFILE_ERROR ((HFILE)-1)
150 /* The SIZE structure */
151 typedef struct tagSIZE
153 LONG cx;
154 LONG cy;
155 } SIZE, *PSIZE, *LPSIZE;
157 typedef SIZE SIZEL, *PSIZEL, *LPSIZEL;
159 /* The POINT structure */
160 typedef struct tagPOINT
162 LONG x;
163 LONG y;
164 } POINT, *PPOINT, *LPPOINT;
166 typedef struct _POINTL
168 LONG x;
169 LONG y;
170 } POINTL;
172 /* The POINTS structure */
174 typedef struct tagPOINTS
176 SHORT x;
177 SHORT y;
178 } POINTS, *PPOINTS, *LPPOINTS;
180 /* The RECT structure */
181 typedef struct tagRECT
183 INT left;
184 INT top;
185 INT right;
186 INT bottom;
187 } RECT, *PRECT, *LPRECT;
188 typedef const RECT *LPCRECT;
191 typedef struct tagRECTL
193 LONG left;
194 LONG top;
195 LONG right;
196 LONG bottom;
197 } RECTL, *PRECTL, *LPRECTL;
199 typedef const RECTL *LPCRECTL;
201 #ifdef __cplusplus
203 #endif
205 #endif /* __WINE_WINDEF_H */