Here's the wndproc:
Code:
static __declspec(dllexport)
LRESULT CALLBACK WndProcedure(HWND hWnd, UINT wMessage,
WPARAM wParam, LPARAM lParam)
{
//retrieve the pointer to the class stored in the HWND
#ifdef _WIN64
CPrintWindow* pWnd = (CPrintWindow*)GetWindowLongPtr(hWnd, 0);
#else
CPrintWindow* pWnd = (CPrintWindow*)GetWindowLong(hWnd, 0);
#endif
if (pWnd == NULL) //this must be the first time here
{
//store the class instance
#ifdef _WIN64
SetWindowLongPtr(hWnd, 0, (ULONG_PTR)m_lastCPrintWindow);
//Set pWnd to point to the class instance
pWnd = (CPrintWindow*)GetWindowLongPtr(hWnd, 0);
#else
SetWindowLong(hWnd, 0, (LONG)m_lastCPrintWindow);
//Set pWnd to point to the class instance
pWnd = (CPrintWindow*)GetWindowLong(hWnd, 0);
#endif
}
return pWnd->OnMainMessage(hWnd, wMessage, wParam, lParam);
}
Here's OnMainMessage():
Code:
//this is the main message loop.
//handles most used messages here
LRESULT CPrintWindow::OnMainMessage(HWND hWnd, UINT wMessage,
WPARAM wParam, LPARAM lParam)
{
//TraceFunc("CPrintWindow::OnMainMessage()");
LRESULT result = 0;
m_hWndMain = hWnd;
if (wMessage == WM_DESTROY)
{
result = 0;
SendMessage(m_hWndMain, WM_QUIT, 0, 0);
}
//first see if this message is handled by any other handler
if (OnMessage(hWnd, wMessage, wParam, lParam, &result))
return result;
//see if the message is one of the basic handled ones,
//and call the correct handler if it is
switch (wMessage)
{
case WM_PAINT:
{
PAINTSTRUCT psPaint;
HDC hDC = BeginPaint(hWnd, &psPaint);
OnPaint(hDC, &psPaint);
EndPaint(hWnd, &psPaint);
}
break;
case WM_ERASEBKGND:
{
HDC hDC = (HDC) wParam;
if (OnEraseBkGnd(hDC))
return true; //handled, so return
else
return DefWindowProc(hWnd, wMessage, wParam, lParam);
}
//break;
case WM_COMMAND:
if(!OnCommand(wParam, lParam))
return DefWindowProc(hWnd, wMessage, wParam, lParam); //return if handled
break;
default:
//seems like this message was not processed by any handler, so
//let's send it to the default handler
return DefWindowProc(hWnd, wMessage, wParam, lParam);
//break;
}
return 0;
}
I wasn't able to find "WM_NCCREATE" or "WM_CREATE" anywhere in the code...