I am currently modifying my code base to compile it under 64-bit architecture. Most of the changes I need to make are obvious, but it puzzled me. SetWindowPos has a second argument, hWndInsertAfter , which can be either a window handle or one of the predefined values HWND_TOP , HWND_BOTTOM , HWND_TOPMOST and HWND_NOTOPMOST (see here for MSDN information). These values ββare defined in WinUser.h .
In a 32-bit architecture, using one of them in a call to SetWindowPos works fine, but in a 64-bit compiler it complains in this way:
warning C4306: 'type cast': conversion from 'int' to 'HWND' of larger size
This is because #defines distinguishes integers [32 bits] as HWNDs, for example:
#define HWND_TOPMOST ((HWND)-1)
What do I need to change to make this compilation in 64-bit architecture without a compiler throwing a warning? I can turn off warnings with #pragma warning( disable: 4306 ) or make my own definition using a 64-bit int in #define, but of course, is there a βrightβ way for Microsoft to do this?
c winapi visual-studio-2012
Nick shaw
source share