Recieving warnings in window code
i get these warnings when i compile my code i wonder if any one knows how to solve them
g:\CodeBase\C++\GLWindow\GLWindow.cpp(364) : warning C4312: 'type cast' : conversion from 'LONG' to 'CGLWindow *' of greater size
g:\CodeBase\C++\GLWindow\GLWindow.cpp(389) : warning C4312: 'type cast' : conversion from 'LONG' to 'HINSTANCE' of greater size
g:\CodeBase\C++\GLWindow\GLWindow.cpp(392) : warning C4311: 'type cast' : pointer truncation from 'CGLWindow *' to 'LONG'
heres the code that get the waring
LRESULT APIENTRY WinProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
CGLWindow *pWin = (CGLWindow*)GetWindowLong(hWnd, GWL_USERDATA);
// make sure window has been created
if ((pWin == NULL) && (msg != WM_CREATE))
{
return DefWindowProc(hWnd, msg, wParam, lParam);
}
.
.
.
case WM_CREATE: // window creation
{
HINSTANCE hInst = (HINSTANCE)GetWindowLong(hWnd, GWL_HINSTANCE);
pWin = (CGLWindow*)(((LPCREATESTRUCT)lParam)->lpCreateParams);
::SetWindowLong(hWnd, GWL_USERDATA, (LONG)pWin);
pWin->m_hWnd = hWnd;
return pWin->Create();
}
.
.
.
return ::DefWindowProc(hWnd, msg, wParam, lParam);
}
i've trimmed out the unessary to save having to read loads
i would be grateful of any help
cheers wardrobe (i was'nt quite awake when i sign up and missed a 'r' out my username)
If you are using VC.NET make sure you have disabled 64-bit portability issues. To do so go to project properties->C/C++->detect 64bit portability issues.
A better solution is to make your code portable to 64-bit by using Set|GetWindowLongPtr()
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement