Mysterious Quit

Recommended Posts

OK well I was just writing up the beginnings of a program, just made a simple "clear screen to blue" for the time being. Anyway it worked fine, so I went to add a function for loading/displaying 2d images, which I screwed up (made it overcomplicated). I deleted all that stuff so the program was back to how it was before - just clear the screen to blue. It compiles fine but now when I run it it quits upon entering winmain. . . I ran the VC++6 debug and here is the output from that:
Quote:
Can someone tell me what on earth is going on!

Share on other sites
The "no matching symbolic information found" messages just mean that you don't have the necessary info to debug into those system files. It's very unlikely they have anything to do with your problem.

I don't know why your program exited.

Share on other sites
Well, I guess you deleted too much.

"Loaded 'xxxx.dll', no matching symbolic information found" is normal and not an error.

Share on other sites
hmm OK thanks..

Im pretty sure all the code is there. . . *sigh*

Share on other sites
Do you have some kind of event loop and are you sure you enter it ? Sounds like the program is terminating prematurely to me.

Edit: Wow, that's what I call a tautology. I'll leave it here for future reference. [grin]

Share on other sites
Ive isolated the problem down to this area...

	wndHandle = CreateWindow("3DTest", 							 "3DTest", 							 WS_OVERLAPPEDWINDOW,							 CW_USEDEFAULT, 							 CW_USEDEFAULT, 							 800,							 600,							 NULL, 							 NULL, 							 hInstance, 							 NULL);	if (!wndHandle)	{	  MessageBox(NULL, "!wndHandle", "message", MB_OK);      return false;	}

!wndHandle is true, which is causing the program to quit just after winmain() is entered.

HWND wndHandle is a global variable defined at the start of the file...

Share on other sites
Show your window proc, it might be the cause of CreateWindow failing.
Alternatively you can output the value of GetLastError and look it up in the Error Lookup Tool (inside VS, Extras).

Share on other sites
I've encountered some incidents where a CRT assertion triggers, but instead of actually popping up an assertion dialog box, the CRT simply forced the app to exit when the assert failed.

As for finding the actual assertion? Good freaking luck. I usually resort to progressive elimination, commenting things until the app exits normally.

Share on other sites
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam){	switch (message) 	{		case WM_DESTROY:			PostQuitMessage(0);			break;	}	return DefWindowProc(hWnd, message, wParam, lParam);}

Here is WndProc!

Can someone tell me how I might go about outputting GetLastError() . . to say a messagebox?

Share on other sites
Ok, the WindowProc isn't at fault. You could use the debugger to get the value of GetLastError(). Just assign it to a variable and look at it in the watch window.

Another shot in the dark:
Is RegisterClass still being used? Maybe the class stuff got axed as well.

Share on other sites
I agree with Endurion, that you've probably deleted your RegisterClass(Ex) or modified it incorrectly, since your CreateWindowEx call seems correct. It should be before your CreateWindowEx and should be creating a window class called "3DTest".

tj963

Share on other sites
you mean this bit?

	WNDCLASSEX wcex;	wcex.cbSize = sizeof(WNDCLASSEX);	wcex.style			= CS_HREDRAW | CS_VREDRAW;	wcex.lpfnWndProc	= (WNDPROC)WndProc;	wcex.cbClsExtra		= 0;	wcex.cbWndExtra		= 0;	wcex.hInstance		= hInstance;	wcex.hIcon			= 0;	wcex.hCursor		= LoadCursor(NULL, IDC_ARROW);	wcex.hbrBackground	= (HBRUSH)(COLOR_WINDOW+1);	wcex.lpszMenuName	= NULL;	wcex.lpszClassName	= "3DTest";	wcex.hIconSm		= 0;	RegisterClassEx(&wcex);

Also i'm not sure by what you mean with "watch window" in relation to debugger..

Share on other sites
hi. my guess is you forgot to include some library into your program, or you dont' use the proper CRT libraries for your application. I've seen this kind of output so many times.... :D

Share on other sites
all libraries are included as the file worked previously with no change to the include section (as mentioned earlier i added some extra stuff which i then removed, but no change to inclusions).

Share on other sites
Have you tried checking the return value from RegisterClass()?

Create an account

Register a new account

• Forum Statistics

• Total Topics
628282
• Total Posts
2981805

• 9
• 10
• 11
• 17
• 14