i havent had this problem before, with either the CreateWindow or CreateWindowEx functions, but suddenly my window wont create and ive tried everything i can think of to no avail.
this is my setup:
Code:
WNDCLASS wnd;
wnd.style = CS_HREDRAW | CS_VREDRAW;
wnd.cbClsExtra = 0;
wnd.cbWndExtra = 0;
wnd.lpfnWndProc = (WNDPROC)WndProc;
wnd.hInstance = hInstance;
wnd.hCursor = LoadCursor(NULL, MAKEINTRESOURCE(IDC_CURSOR1));
wnd.hIcon = LoadIcon(NULL, MAKEINTRESOURCE(IDI_ICON1));
wnd.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
wnd.lpszMenuName = MAKEINTRESOURCE(IDR_MENU1);
wnd.lpszClassName = "MyClass";
if ( ! RegisterClass( &wnd ) )
{
MessageBox(NULL, "Window Registration Failed!", "Error", MB_OK);
return 0;
}
HWND hWnd = CreateWindow( wnd.lpszClassName, "Window", WS_OVERLAPPEDWINDOW,
0, 0, 500, 500, NULL, NULL, hInstance, NULL);
if ( !hWnd )
{
MessageBox(NULL, "Window Creation Failed!", "Error", MB_OK);
return 0;
}
it compiles fine and i cant find anything wrong with it, but i get the "creation failed" popup every time.
any thoughts?