]>
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
);
50 inline BOOL
GetCharWidth(HDC dc
, UINT first
, UINT last
, LPINT buffer
)
53 return GetCharWidthW(dc
, first
, last
, buffer
);
55 return GetCharWidthA(dc
, first
, last
, buffer
);
65 inline HWND
FindWindow(LPCWSTR classname
, LPCWSTR windowname
)
67 return FindWindowW(classname
, windowname
);
70 inline HWND
FindWindow(LPCSTR classname
, LPCSTR windowname
)
72 return FindWindowA(classname
, windowname
);
82 inline BOOL
PlaySound(LPCWSTR pszSound
, HMODULE hMod
, DWORD fdwSound
)
84 return PlaySoundW(pszSound
, hMod
, fdwSound
);
87 inline BOOL
PlaySound(LPCSTR pszSound
, HMODULE hMod
, DWORD fdwSound
)
89 return PlaySoundA(pszSound
, hMod
, fdwSound
);
99 inline int GetClassName(HWND h
, LPWSTR classname
, int maxcount
)
101 return GetClassNameW(h
, classname
, maxcount
);
104 inline int GetClassName(HWND h
, LPSTR classname
, int maxcount
)
106 return GetClassNameA(h
, classname
, maxcount
);
116 inline BOOL
GetClassInfo(HINSTANCE h
, LPCWSTR name
, LPWNDCLASSW winclass
)
118 return GetClassInfoW(h
, name
, winclass
);
121 inline BOOL
GetClassInfo(HINSTANCE h
, LPCSTR name
, LPWNDCLASSA winclass
)
123 return GetClassInfoA(h
, name
, winclass
);
130 #ifdef LoadAccelerators
131 #undef LoadAccelerators
133 inline HACCEL
LoadAccelerators(HINSTANCE h
, LPCWSTR name
)
135 return LoadAcceleratorsW(h
, name
);
138 inline HACCEL
LoadAccelerators(HINSTANCE h
, LPCSTR name
)
140 return LoadAcceleratorsA(h
, name
);
150 inline int DrawText(HDC h
, LPCWSTR str
, int count
, LPRECT rect
, UINT format
)
152 return DrawTextW(h
, str
, count
, rect
, format
);
155 inline int DrawText(HDC h
, LPCSTR str
, int count
, LPRECT rect
, UINT format
)
157 return DrawTextA(h
, str
, count
, rect
, format
);
166 #if defined( __GNUG__ ) && !wxCHECK_W32API_VERSION( 0, 5 )
167 #define DOCINFOW DOCINFO
168 #define DOCINFOA DOCINFO
171 inline int StartDoc(HDC h
, CONST DOCINFOW
* info
)
173 return StartDocW(h
, (DOCINFOW
*) info
);
176 inline int StartDoc(HDC h
, CONST DOCINFOA
* info
)
178 return StartDocA(h
, (DOCINFOA
*) info
);
187 inline int GetObject(HGDIOBJ h
, int i
, LPVOID buffer
)
190 return GetObjectW(h
, i
, buffer
);
192 return GetObjectA(h
, i
, buffer
);
201 inline int GetMessage(LPMSG lpMsg
, HWND hWnd
, UINT wMsgFilterMin
, UINT wMsgFilterMax
)
204 return GetMessageW(lpMsg
, hWnd
, wMsgFilterMin
, wMsgFilterMax
);
206 return GetMessageA(lpMsg
, hWnd
, wMsgFilterMin
, wMsgFilterMax
);
216 inline HINSTANCE
LoadLibrary(LPCWSTR lpLibFileName
)
218 return LoadLibraryW(lpLibFileName
);
221 inline HINSTANCE
LoadLibrary(LPCSTR lpLibFileName
)
223 return LoadLibraryA(lpLibFileName
);
232 inline HRSRC
FindResource(HMODULE hModule
, LPCWSTR lpName
, LPCWSTR lpType
)
234 return FindResourceW(hModule
, lpName
, lpType
);
237 inline HRSRC
FindResource(HMODULE hModule
, LPCSTR lpName
, LPCSTR lpType
)
239 return FindResourceA(hModule
, lpName
, lpType
);
248 inline BOOL
IsMaximized(HWND hwnd
)
250 return IsZoomed(hwnd
);
258 inline HWND
GetFirstChild(HWND hwnd
)
260 return GetTopWindow(hwnd
);
266 #ifdef GetPrevSibling
267 #undef GetPrevSibling
268 inline HWND
GetPrevSibling(HWND hwnd
)
270 return GetWindow(hwnd
,GW_HWNDPREV
);
276 #ifdef GetNextSibling
277 #undef GetNextSibling
278 inline HWND
GetNextSibling(HWND hwnd
)
280 return GetWindow(hwnd
,GW_HWNDNEXT
);
286 #if defined(GetWindowStyle) || defined(__WXWINE__)
287 #undef GetWindowStyle
290 // For ming and cygwin
295 inline HWND
GetFirstChild(HWND h
)
297 return GetTopWindow(h
);
303 #ifdef GetNextSibling
304 #undef GetNextSibling
305 inline HWND
GetNextSibling(HWND h
)
307 return GetWindow(h
, GW_HWNDNEXT
);
317 //ifdef GetWindowProc
318 // #undef GetWindowProc
321 // #undef GetNextChild
324 // #endif // _WX_WINUNDEF_H_