I am at my wit's end with this thing. I just can't figure out, why I cannot set the WNDCLASSEX.lpfnWndProc equal to my class's function. Can someone help? Here's my code:
system.h
#ifndef SYSTEM_H
#define SYSTEM_H
#include "stdinc.h"
class System {
private:
void initD3D (void);
void cleanD3D (void);
LRESULT CALLBACK WindowProc(UINT, WPARAM, LPARAM);
void setUpHWND (HINSTANCE, LPSTR, int);
HWND window;
WNDCLASSEX windowClass;
LPDIRECT3D9 d3d;
LPDIRECT3DDEVICE9 d3ddev;
HINSTANCE hInstance;
LPSTR lpCmdLine;
int nCmdShow;
public:
System (void);
System (HINSTANCE, LPSTR, int);
System (const System&);
~System (void);
void renderFrame (void);
};
#endif
system.cpp
#include "system.h"
//////////////////////////////////////////////////
// Class: System
// Private
//////////////////////////////////////////////////
void System::initD3D (void) {
};
void System::cleanD3D (void) {
};
LRESULT CALLBACK System::WindowProc (UINT message, WPARAM wParam, LPARAM lParam) {
switch(message)
{
case WM_DESTROY:
{
PostQuitMessage(0);
return 0;
} break;
}
return DefWindowProc(this->window, message, wParam, lParam);
};
void System::setUpHWND (
HINSTANCE hInstance,
LPSTR lpCmdLine,
int nCmdShow) {
this->hInstance = hInstance;
this->lpCmdLine = lpCmdLine;
this->nCmdShow = nCmdShow;
ZeroMemory(&(this->windowClass), sizeof(WNDCLASSEX));
this->windowClass.cbSize = sizeof(WNDCLASSEX);
this->windowClass.style = CS_HREDRAW | CS_VREDRAW;
this->windowClass.lpfnWndProc = this->WindowProc;
this->windowClass.hInstance = this->hInstance;
this->windowClass.hCursor = LoadCursor(NULL, IDC_ARROW);
this->windowClass.lpszClassName = "WindowClass";
RegisterClassEx(&(this->windowClass));
this->window = CreateWindowEx(NULL, "WindowClass", "The Direct3D Program",
WS_OVERLAPPEDWINDOW, SCREEN_X, SCREEN_Y, SCREEN_WIDTH, SCREEN_HEIGHT,
NULL, NULL, this->hInstance, NULL);
};
//////////////////////////////////////////////////
// Class: System
// Public
//////////////////////////////////////////////////
/*
System::System (void) {
this->setUpHWND(HINSTANCE hInstance, LPSTR lpCmdLine, int nCmdShow);
};
*/
System::System (void) {
};
System::System (
HINSTANCE hInstance,
LPSTR lpCmdLine,
int nCmdShow) {
this->setUpHWND(hInstance, lpCmdLine, nCmdShow);
ShowWindow(this->window, this->nCmdShow);
this->initD3D();
};
System::System (const System &) {
};
System::~System (void) {
this->cleanD3D();
};
void System::renderFrame (void) {
};
And I've already tried making the WindowProc function public instead of private. No go. Here's my exact error:
system.cpp(25) : error C3867: 'System::WindowProc': function call missing argument list; use '&System::WindowProc' to create a pointer to member
system.cpp(25) : error C2440: '=' : cannot convert from 'LRESULT (__stdcall System::* )(UINT,WPARAM,LPARAM)' to 'WNDPROC'
Obviously, I've tried that, still no go.