Original Post
I have the following lines of code in my program:
WNDCLASSEX window;
HWND hWnd;
MSG msg;
window.cbSize = sizeof(WNDCLASSEX);
window.style = CS_DBLCLKS | CS_OWNDC | CS_HREDRAW | CS_VREDRAW;
window.lpfnWndProc = WinProc;
window.cbClsExtra = 0;
window.cbWndExtra = 0;
window.hInstance = hInstance;
window.hIcon = LoadIcon(NULL, IDI_APPLICATION);
window.hCursor = LoadCursor(NULL, IDC_ARROW);
window.hbrBackground = (HBRUSH) GetStockObject(BLACK_BRUSH);
window.lpszMenuName = NULL;
window.lpszClassName = "TheGame";
window.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
// register the window class
if (!RegisterClassEx(&window))
return (0);
MessageBox(NULL, "DEBUG 1", "DEBUG", NULL);
// create the window
if (!(hWnd = CreateWindowEx(NULL,
"TheGame",
"Sample",
WS_EX_TOPMOST | WS_POPUP | WS_VISIBLE,
0, 0, SCREEN_WIDTH, SCREEN_HEIGHT,
NULL,
NULL,
hInstance,
NULL)))
{
return (0);
}
MessageBox(NULL, "DEBUG 2", "DEBUG", NULL);
This code used to work flawlessly. Suddenly, it decided to not work no matter how many times I reboot, or no matter how many times I change the registering class name. The problem lies in the CreateWindowEx line (I know this because the first MessageBox displays, but the second one doesn't). Does anyone know why it's suddenly screwed up, and how I might go about fixing it? Thanks SO MUCH...this is obviously a major setback, as it stops my entire program from running!
[edited by - Mattman on October 29, 2002 1:36:35 PM]