MrDoomMaster
November 27th, 2004, 08:59 PM
I must be stupid, I don't know why this isn't working:
//====================================================================================
/*
|| Creates a window for the game
|| Returns NULL if failed, the window handle if successful.
*/
HWND DirectX_Utils::GameWindowCreate(string WindowTitle)
{
WNDCLASS CS;
CS.cbClsExtra = 0;
CS.cbWndExtra = 0;
CS.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
CS.hIcon = NULL;
CS.hCursor = NULL;
CS.hInstance = GlobalInstance;
CS.lpfnWndProc = WindowProcedure;
CS.lpszClassName = "GameAppClass";
CS.lpszMenuName = 0;
CS.style = CS_VREDRAW | CS_HREDRAW | CS_DBLCLKS | CS_OWNDC;
if(!RegisterClass(&CS))
return NULL;
return (MainWindow = CreateWindow("GameAppClass", WindowTitle.c_str(), WS_POPUP | WS_VISIBLE,
100, 100, 300, 300, NULL, NULL, GlobalInstance, NULL));
}
CreateWindow returns NULL!
GlobalInstance and WindowProcedure are both private members of my class, which are initialized appropriately at construction.
MainWindow is a private member also which receives the handle to the window.
//====================================================================================
/*
|| Creates a window for the game
|| Returns NULL if failed, the window handle if successful.
*/
HWND DirectX_Utils::GameWindowCreate(string WindowTitle)
{
WNDCLASS CS;
CS.cbClsExtra = 0;
CS.cbWndExtra = 0;
CS.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
CS.hIcon = NULL;
CS.hCursor = NULL;
CS.hInstance = GlobalInstance;
CS.lpfnWndProc = WindowProcedure;
CS.lpszClassName = "GameAppClass";
CS.lpszMenuName = 0;
CS.style = CS_VREDRAW | CS_HREDRAW | CS_DBLCLKS | CS_OWNDC;
if(!RegisterClass(&CS))
return NULL;
return (MainWindow = CreateWindow("GameAppClass", WindowTitle.c_str(), WS_POPUP | WS_VISIBLE,
100, 100, 300, 300, NULL, NULL, GlobalInstance, NULL));
}
CreateWindow returns NULL!
GlobalInstance and WindowProcedure are both private members of my class, which are initialized appropriately at construction.
MainWindow is a private member also which receives the handle to the window.