INT_PTR CALLBACK SWindow::SDialogPropertySheetPageProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { SWindow* SWindowClass; if(uMsg == WM_INITDIALOG) { SWindowClass = reinterpret_cast<SWindow*>(reinterpret_cast<PROPSHEETPAGE*>(lParam)->lParam); ::SetWindowLongPtr(hwnd, GWLP_USERDATA, PtrToLong(SWindowClass)); } else { SWindowClass = reinterpret_cast<SWindow*>(::GetWindowLongPtr(hwnd, GWLP_USERDATA)); } INT_PTR RetCode; if(SWindowClass) { RetCode = SWindowClass->WndProc(hwnd, uMsg, wParam, lParam); } else { RetCode = false; } return RetCode; }
LRESULT CALLBACK SWindow::SWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { SWindow* SWindowClass; if(uMsg == WM_CREATE) { SWindowClass = reinterpret_cast<SWindow*> (reinterpret_cast<LPCREATESTRUCT>(lParam)->lpCreateParams); ::SetWindowLongPtr(hwnd, GWLP_USERDATA, PtrToLong(SWindowClass)); } else { SWindowClass = reinterpret_cast<SWindow*>(::GetWindowLongPtr(hwnd, GWLP_USERDATA)); } LRESULT RetCode; if(SWindowClass) { RetCode = SWindowClass->WndProc(hwnd, uMsg, wParam, lParam); } else { RetCode = ::DefWindowProc(hwnd, uMsg, wParam, lParam); } return RetCode; }