]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/winundef.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: undefine the common symbols #define'd by <windows.h>
4 // Author: Vadim Zeitlin
8 // Copyright: (c) wxWindows team
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 /* THIS SHOULD NOT BE USED since you might include it once e.g. in window.h,
13 * then again _AFTER_ you've included windows.h, in which case it won't work
15 #ifndef _WX_WINUNDEF_H_
16 #define _WX_WINUNDEF_H_
19 // ----------------------------------------------------------------------------
20 // windows.h #defines the following identifiers which are also used in wxWin so
21 // we replace these symbols with the corresponding inline functions and
22 // undefine the macro.
24 // This looks quite ugly here but allows us to write clear (and correct!) code
25 // elsewhere because the functions, unlike the macros, respect the scope.
26 // ----------------------------------------------------------------------------
33 inline HWND
CreateDialog(HINSTANCE hInstance
,
39 return CreateDialogW(hInstance
, pTemplate
, hwndParent
, pDlgProc
);
41 return CreateDialogA(hInstance
, pTemplate
, hwndParent
, pDlgProc
);
51 inline HMENU
LoadMenu(HINSTANCE instance
, LPCTSTR name
)
54 return LoadMenuW(instance
, name
);
56 return LoadMenuA(instance
, name
);
65 inline BOOL
GetCharWidth(HDC dc
, UINT first
, UINT last
, LPINT buffer
)
68 return GetCharWidthW(dc
, first
, last
, buffer
);
70 return GetCharWidthA(dc
, first
, last
, buffer
);
80 inline HWND
FindWindow(LPCWSTR classname
, LPCWSTR windowname
)
82 return FindWindowW(classname
, windowname
);
85 inline HWND
FindWindow(LPCSTR classname
, LPCSTR windowname
)
87 return FindWindowA(classname
, windowname
);
97 inline BOOL
PlaySound(LPCWSTR pszSound
, HMODULE hMod
, DWORD fdwSound
)
99 return PlaySoundW(pszSound
, hMod
, fdwSound
);
102 inline BOOL
PlaySound(LPCSTR pszSound
, HMODULE hMod
, DWORD fdwSound
)
104 return PlaySoundA(pszSound
, hMod
, fdwSound
);
114 inline int GetClassName(HWND h
, LPWSTR classname
, int maxcount
)
116 return GetClassNameW(h
, classname
, maxcount
);
119 inline int GetClassName(HWND h
, LPSTR classname
, int maxcount
)
121 return GetClassNameA(h
, classname
, maxcount
);
131 inline BOOL
GetClassInfo(HINSTANCE h
, LPCWSTR name
, LPWNDCLASSW winclass
)
133 return GetClassInfoW(h
, name
, winclass
);
136 inline BOOL
GetClassInfo(HINSTANCE h
, LPCSTR name
, LPWNDCLASSA winclass
)
138 return GetClassInfoA(h
, name
, winclass
);
145 #ifdef LoadAccelerators
146 #undef LoadAccelerators
148 inline HACCEL
LoadAccelerators(HINSTANCE h
, LPCWSTR name
)
150 return LoadAcceleratorsW(h
, name
);
153 inline HACCEL
LoadAccelerators(HINSTANCE h
, LPCSTR name
)
155 return LoadAcceleratorsA(h
, name
);
165 inline int DrawText(HDC h
, LPCWSTR str
, int count
, LPRECT rect
, UINT format
)
167 return DrawTextW(h
, str
, count
, rect
, format
);
170 inline int DrawText(HDC h
, LPCSTR str
, int count
, LPRECT rect
, UINT format
)
172 return DrawTextA(h
, str
, count
, rect
, format
);
179 When this file is included, sometimes the wxCHECK_W32API_VERSION macro
180 is undefined. With for example CodeWarrior this gives problems with
182 #if 0 && wxCHECK_W32API_VERSION( 0, 5 )
183 Because CodeWarrior does macro expansion before test evaluation.
184 We define wxCHECK_W32API_VERSION here if it's undefined.
186 #if !defined(__GNUG__) && !defined(wxCHECK_W32API_VERSION)
187 #define wxCHECK_W32API_VERSION(maj, min) (0)
194 #if defined( __GNUG__ ) && !wxCHECK_W32API_VERSION( 0, 5 )
195 #define DOCINFOW DOCINFO
196 #define DOCINFOA DOCINFO
199 inline int StartDoc(HDC h
, CONST DOCINFOW
* info
)
201 return StartDocW(h
, (DOCINFOW
*) info
);
204 inline int StartDoc(HDC h
, CONST DOCINFOA
* info
)
206 return StartDocA(h
, (DOCINFOA
*) info
);
215 inline int GetObject(HGDIOBJ h
, int i
, LPVOID buffer
)
218 return GetObjectW(h
, i
, buffer
);
220 return GetObjectA(h
, i
, buffer
);
229 inline int GetMessage(LPMSG lpMsg
, HWND hWnd
, UINT wMsgFilterMin
, UINT wMsgFilterMax
)
232 return GetMessageW(lpMsg
, hWnd
, wMsgFilterMin
, wMsgFilterMax
);
234 return GetMessageA(lpMsg
, hWnd
, wMsgFilterMin
, wMsgFilterMax
);
244 inline HINSTANCE
LoadLibrary(LPCWSTR lpLibFileName
)
246 return LoadLibraryW(lpLibFileName
);
249 inline HINSTANCE
LoadLibrary(LPCSTR lpLibFileName
)
251 return LoadLibraryA(lpLibFileName
);
260 inline HRSRC
FindResource(HMODULE hModule
, LPCWSTR lpName
, LPCWSTR lpType
)
262 return FindResourceW(hModule
, lpName
, lpType
);
265 inline HRSRC
FindResource(HMODULE hModule
, LPCSTR lpName
, LPCSTR lpType
)
267 return FindResourceA(hModule
, lpName
, lpType
);
276 inline BOOL
IsMaximized(HWND hwnd
)
278 return IsZoomed(hwnd
);
286 inline HWND
GetFirstChild(HWND hwnd
)
288 return GetTopWindow(hwnd
);
294 #ifdef GetPrevSibling
295 #undef GetPrevSibling
296 inline HWND
GetPrevSibling(HWND hwnd
)
298 return GetWindow(hwnd
,GW_HWNDPREV
);
304 #ifdef GetNextSibling
305 #undef GetNextSibling
306 inline HWND
GetNextSibling(HWND hwnd
)
308 return GetWindow(hwnd
,GW_HWNDNEXT
);
314 #if defined(GetWindowStyle) || defined(__WXWINE__)
315 #undef GetWindowStyle
318 // For ming and cygwin
323 inline HWND
GetFirstChild(HWND h
)
325 return GetTopWindow(h
);
331 #ifdef GetNextSibling
332 #undef GetNextSibling
333 inline HWND
GetNextSibling(HWND h
)
335 return GetWindow(h
, GW_HWNDNEXT
);
345 //ifdef GetWindowProc
346 // #undef GetWindowProc
349 // #undef GetNextChild
352 // #endif // _WX_WINUNDEF_H_