Code:
class Window
{
public:
void CreateWnd(HWND parentwnd);
.
.
.
private:
static int APIENTRY WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
HWND
m_hwnd;
};
void Window::CreateWnd(HWND parentwnd)
{
m_hwnd = ::CreateWindow("ClassName","title stuff",
WS_BLAHBLAH, x, y, w, h,
parentwnd, (HMENU)NULL, hInst, (LPARAM)this);
}
int APIENTRY Window::WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
Window *This = (Window*)GetWindowLong(hWnd,GWL_USERDATA);
if(message == WM_CREATE)
{
CREATESTRUCT *cs = lParam;
This = (Window*)cs->lpCreateParams;
SetWindowLong(hWnd,GWL_USERDATA, cs->lpCreateParams);
}
if(This)
return This->CallBack(message, wParam, lParam);
else
return DefWindowProc(hWnd, message, wParam, lParam)
}
probably errors in this code, I just typed it in the browser and didn't actually attempt a compile but this is the idea