avoid warnings C4311/4312 when building with MSVC >= 7 (patch 1414052)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@37399 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2006-02-08 22:32:42 +00:00
parent 3cf545c76c
commit 5489227348
2 changed files with 13 additions and 26 deletions

View File

@@ -894,38 +894,28 @@ inline void *wxSetWindowUserData(HWND hwnd, void *data)
#else // __WIN32__
#ifdef __VISUALC__
// strangely enough, VC++ 7.1 gives warnings about 32 -> 64 bit conversions
// in the functions below, even in spite of the explicit casts
#pragma warning(disable:4311)
#pragma warning(disable:4312)
#endif
// note that the casts to LONG_PTR here are required even on 32-bit machines
// for the 64-bit warning mode of later versions of MSVC (C4311/4312)
inline void *wxGetWindowProc(HWND hwnd)
{
return (void *)::GetWindowLong(hwnd, GWL_WNDPROC);
return (void *)(LONG_PTR)::GetWindowLong(hwnd, GWL_WNDPROC);
}
inline void *wxGetWindowUserData(HWND hwnd)
{
return (void *)::GetWindowLong(hwnd, GWL_USERDATA);
return (void *)(LONG_PTR)::GetWindowLong(hwnd, GWL_USERDATA);
}
inline WNDPROC wxSetWindowProc(HWND hwnd, WNDPROC func)
{
return (WNDPROC)::SetWindowLong(hwnd, GWL_WNDPROC, (LONG)func);
return (WNDPROC)(LONG_PTR)::SetWindowLong(hwnd, GWL_WNDPROC, (LONG_PTR)func);
}
inline void *wxSetWindowUserData(HWND hwnd, void *data)
{
return (void *)::SetWindowLong(hwnd, GWL_USERDATA, (LONG)data);
return (void *)(LONG_PTR)::SetWindowLong(hwnd, GWL_USERDATA, (LONG_PTR)data);
}
#ifdef __VISUALC__
#pragma warning(default:4311)
#pragma warning(default:4312)
#endif
#endif // __WIN64__/__WIN32__
#endif // wxUSE_GUI