Recieving warnings in window code

Started by
2 comments, last by andrew_wardobe 18 years, 9 months ago
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)
Andrew Wardrobe
Advertisement
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()
Cheers guys you both helped although i'm not going for 64bit support untill i can get driver for my modem that works with64 window i mite wait untill longhorn comes out
Andrew Wardrobe

This topic is closed to new replies.

Advertisement