Sign in to follow this  
andrew_wardobe

Recieving warnings in window code

Recommended Posts

andrew_wardobe    122
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)

Share this post


Link to post
Share on other sites
enmaniac    197
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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this