Can someone please help me resolve this warnings? Ive fixed many of the others, its just these ones that I'm stuck at.
I'm using Visual Studio 2005 Standard w/SP1. MFC Dialog App (non-unicode)
warning C4311: 'type cast' : pointer truncation from 'HICON' to 'int'
warning C4312: 'type cast' : conversion from 'unsigned long' to 'HICON' of greater
Code:#define BTNST_AUTO_GRAY (HICON)(0xffffffff - 1L) // Set icon when the mouse is IN the button hIconIn = (HICON)::LoadImage(hInstResource, MAKEINTRESOURCE(nIconIn), IMAGE_ICON, nCxDesiredIn, nCyDesiredIn, 0); switch ((int)hIconIn) // C4311 { case NULL: break; case (int)BTNST_AUTO_GRAY: // C4312 hIconOut = BTNST_AUTO_GRAY; break; case (int)BTNST_AUTO_DARKER: hIconOut = BTNST_AUTO_DARKER; break; default: hIconOut = (HICON)::LoadImage(hInstResource, MAKEINTRESOURCE(nIconOut), IMAGE_ICON, nCxDesiredOut, nCyDesiredOut, 0); break; } // switch
C4311: 'type cast' : pointer truncation from 'LRESULT (__stdcall *)(HWND,UINT,WPARAM,LPARAM)' to 'DWORD'
C4312: 'type cast' : conversion from 'LONG' to 'WNDPROC' of greater size
Code:WNDPROC oldWindowProc; oldWindowProc = (WNDPROC)::SetWindowLong(GetParent()->m_hWnd, GWL_WNDPROC, (DWORD)SubclassWindowProc); // C4311 and 4312




Reply With Quote