Here is what you had:
Code:
LRESULT CALLBACK Application::WndProcStub(HWND hwnd, UINT msg, WPARAM w, LPARAM l)
{
	if(msg == WM_NCCREATE)
	{
		::CREATESTRUCT *pcs = reinterpret_cast<::CREATESTRUCT *>(l);
		::SetWindowLongPtr(hwnd, 0,
			reinterpret_cast<LONG_PTR>(pcs->lpCreateParams));
	}
	Application *pthis = reinterpret_cast<Application *>(
		::GetWindowLongPtr(hwnd, 0);
	return pthis->WndProc(hwnd, msg, w, l);
}