]>
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
);
181 #if defined( __GNUG__ ) && !wxCHECK_W32API_VERSION( 0, 5 )
182 #define DOCINFOW DOCINFO
183 #define DOCINFOA DOCINFO
186 inline int StartDoc(HDC h
, CONST DOCINFOW
* info
)
188 return StartDocW(h
, (DOCINFOW
*) info
);
191 inline int StartDoc(HDC h
, CONST DOCINFOA
* info
)
193 return StartDocA(h
, (DOCINFOA
*) info
);
202 inline int GetObject(HGDIOBJ h
, int i
, LPVOID buffer
)
205 return GetObjectW(h
, i
, buffer
);
207 return GetObjectA(h
, i
, buffer
);
216 inline int GetMessage(LPMSG lpMsg
, HWND hWnd
, UINT wMsgFilterMin
, UINT wMsgFilterMax
)
219 return GetMessageW(lpMsg
, hWnd
, wMsgFilterMin
, wMsgFilterMax
);
221 return GetMessageA(lpMsg
, hWnd
, wMsgFilterMin
, wMsgFilterMax
);
231 inline HINSTANCE
LoadLibrary(LPCWSTR lpLibFileName
)
233 return LoadLibraryW(lpLibFileName
);
236 inline HINSTANCE
LoadLibrary(LPCSTR lpLibFileName
)
238 return LoadLibraryA(lpLibFileName
);
247 inline HRSRC
FindResource(HMODULE hModule
, LPCWSTR lpName
, LPCWSTR lpType
)
249 return FindResourceW(hModule
, lpName
, lpType
);
252 inline HRSRC
FindResource(HMODULE hModule
, LPCSTR lpName
, LPCSTR lpType
)
254 return FindResourceA(hModule
, lpName
, lpType
);
263 inline BOOL
IsMaximized(HWND hwnd
)
265 return IsZoomed(hwnd
);
273 inline HWND
GetFirstChild(HWND hwnd
)
275 return GetTopWindow(hwnd
);
281 #ifdef GetPrevSibling
282 #undef GetPrevSibling
283 inline HWND
GetPrevSibling(HWND hwnd
)
285 return GetWindow(hwnd
,GW_HWNDPREV
);
291 #ifdef GetNextSibling
292 #undef GetNextSibling
293 inline HWND
GetNextSibling(HWND hwnd
)
295 return GetWindow(hwnd
,GW_HWNDNEXT
);
301 #if defined(GetWindowStyle) || defined(__WXWINE__)
302 #undef GetWindowStyle
305 // For ming and cygwin
310 inline HWND
GetFirstChild(HWND h
)
312 return GetTopWindow(h
);
318 #ifdef GetNextSibling
319 #undef GetNextSibling
320 inline HWND
GetNextSibling(HWND h
)
322 return GetWindow(h
, GW_HWNDNEXT
);
332 //ifdef GetWindowProc
333 // #undef GetWindowProc
336 // #undef GetNextChild
339 // #endif // _WX_WINUNDEF_H_