Skip to main content
gamedev.net
🔒 Locked

GetWindowLong Problem

Started by Skute Feb 22, 2003 at 10:51 AM 1 replies 250+ views
Original Post
Skute
Skute
Hi, im developing a windows wrapper class, and everything works fine, except for one thing :-/ This is my static callback function to handle the window procedure, it does get called, but when i try to use GetWindowLong, it always returns 0. Anyone else had this problem? Or know a better way to get a pointer to a window? Ive checked out the article on this site, and im doing pretty much exactly the same thing, so i dont understand why its not working? ------- CBaseWindow* pWnd = NULL; // 1) WM_GETMINMAXINFO 0x0024 (36) // 2) WM_NCCREATE 0x0081 (129) if (msg == WM_NCCREATE) { // get the pointer to the window from lpCreateParams which was set in CreateWindow SetWindowLong(hWnd, GWL_USERDATA, (long)((LPCREATESTRUCT(lParam))->lpCreateParams)); } // get the pointer to the window //pWnd = GetObjectFromWindow(hWnd); pWnd = (CBaseWindow *)GetWindowLong(hWnd, GWL_USERDATA); // if we have the pointer, go to the message handler of the window // else, use DefWindowProc if (pWnd) return pWnd->MessageHandler(msg, wParam, lParam); else return DefWindowProc(hWnd, msg, wParam, lParam);
Mark Ingramhttp://www.mark-ingram.com
LessBread
LessBread
CBaseWindow* pWnd = NULL;

Are you forgetting to instance this object?
"I thought what I'd do was, I'd pretend I was one of those deaf-mutes." - the Laughing Man
zealouselixir
zealouselixir
Are you passing the window address via CreateWindowEx properly?
[twitter]warrenm[/twitter]

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.