Original Post
Hi to everyone. I just created a class CWindow which should handle all the nasty details of creating a window with the win32 api.
Looking at a previous post in this forum I found out how to register correctly (or so it would seem) the WndProc needed by the application to proccess messages [url]http://www.gamedev.net/community/forums/topic.asp?topic_id=59171[/url]. I made a static member function inside my class declaration like this (its public):
static LRESULT CALLBACK WndProcStatic(HWND hWnd_, UINT uiMessage_,
WPARAM wParam_, LPARAM lParam_)
{
CWindow *tmpWindow = (CWindow*)GetWindowLong(hWnd_, GWL_USERDATA);
return tmpWindow->WndProc(hWnd_, uiMessage_, wParam_, lParam_);
}
So when I initialize the WNDCLASS variable I use:
m_WindowClass.lpfnWndProc = WndProcStatic;
where m_WindowClass is a private member of my class.
The program compiles fine and runs up to a point.
That point is when I use:
m_hWnd = CreateWindowEx(...) at which the WndProcStatic function
is called. But the GetWindowLongFunction returns me zero, so I get an exception in WndProc. The hWnd_ variable seems to have a reasonable value ath the time GetWindowLong is called. Does anyone one why?