PDA

Click to See Complete Forum and Search --> : CreateWindow Problems


slashandburn
Aug 13th, 2002, 07:47 PM
Im trying to move a pocket pc game i made onto windows and my createwindow function is registering the class, but not making a window. What is wrong with this function.


bool SimpleWindow(LPCTSTR ClassName,LPCTSTR WindowName,HWND &WindowHwnd,HINSTANCE &hInstance)
{
WNDCLASS wc;

wc.style = 0;
wc.cbClsExtra=0;
wc.cbWndExtra=0;
wc.lpfnWndProc = MainWndProc;
wc.hInstance = hInstance;
wc.hbrBackground =(HBRUSH) (COLOR_WINDOW+1);
wc.hCursor=0;
wc.hIcon = 0;
wc.lpszMenuName = 0;
wc.lpszClassName = ClassName;

if(RegisterClass(&wc))
{

WindowHwnd = CreateWindow(ClassName,WindowName,WS_OVERLAPPEDWINDOW,0,0,320,320,NULL,NULL,hInstance,NULL);

if(WindowHwnd != 0)
{
return 1;
}
else
{
MessageBox(0,"Window Create Error","B",0);
return 0;
}
}
else
{
MessageBox(0,"Register Class Error","B",0);
return 0;
}
}

slashandburn
Aug 13th, 2002, 10:43 PM
Nevermind i resolved the problem. I didn't have a return in my WndProc.