Original Post
I''m currently working on a wrapper for DirectX and Win32, but have got stuck on the handle to the instance. The WinMain and the window setup are in two different files. Here''s the different source files:
CApplication.cpp (The InitWindow function)
Main.cpp (Containing the WinMain function)
It comes up with errrors in the CreateWindowEx function call, such as this:
type
bool CGOApp::goInitWindow()
{
WNDCLASSEX wc;
wc.cbSize=sizeof(WNDCLASSEX);
wc.style=CS_OWNDC;
wc.lpfnWndProc=WndProc;
wc.cbClsExtra=0;
wc.cbWndExtra=0;
wc.hInstance=goGetInstance();
wc.hIcon=LoadIcon(NULL,IDI_APPLICATION);
wc.hCursor=NULL;
wc.hbrBackground=(HBRUSH)GetStockObject(BLACK_BRUSH);
wc.lpszMenuName=NULL;
wc.lpszClassName=WINDOWTITLE;
wc.hIconSm=LoadIcon(NULL,IDI_APPLICATION);
RegisterClassEx(&wc);
hWnd=CreateWindowEx(WS_EX_CONTROLPARENT,WINDOWTITLE,WINDOWTITLE,
WS_OVERLAPPED,WINWIDTH,WINHEIGHT,0,0,
wc.hInstance,0);
return true;
}
#include "main.h"
CGOApp cApp;
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmd, int nShow)
{
MSG messages;
while (cApp.goWindowAlive())
{
if(GetMessage(&messages,NULL,0,0))
{
TranslateMessage(&messages);
DispatchMessage(&messages);
}
}
return false;
}
HWND__'' is not a base type for type HINSTANCE__''
Thanks in advance