Sign in to follow this  

Still Having Problem with program not closing properly.

This topic is 4485 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Im still getting this error again. --------------------Configuration: Code - Win32 Debug-------------------- Compiling... main.cpp c:\documents and settings\owner\desktop\lightning round\code\main.cpp(0) : fatal error C1033: cannot open program database 'c:\documents and settings\owner\desktop\lightning round\code\debug\vc60.pdb' Error executing cl.exe. Code.exe - 1 error(s), 0 warning(s) Here is my handler.
LRESULT CALLBACK WindowProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
{
PAINTSTRUCT ps;
HDC hdc;
switch(msg){
case WM_CREATE:
	{
		HDC hdc = GetDC(hwnd);
		COLORREF TextColor = RGB(0,175,0);
		SetTextColor(hdc,TextColor);
		SetBkMode(hdc,TRANSPARENT);
		return(0);
	}break;
case WM_PAINT:
	{
		hdc = BeginPaint(hwnd,&ps);
		TextOut(hdc,55,40,"Username:",strlen("Username:"));
		TextOut(hdc,55,80,"Password:",strlen("Password:"));
		EndPaint(hwnd,&ps);
		return(0);
	}break;
case WM_CLOSE:
	{
		PostQuitMessage(0);
		return(0);
	} break;
case WM_DESTROY:
	{
		PostQuitMessage(0);
		return(0);
	} break;
default:break;
}
return(DefWindowProc(hwnd,msg,wparam,lparam));
}

Share this post


Link to post
Share on other sites
try simply closing the project, deleting all intermediate files (the Release/ and Debug/ folders, the .pdb-file, and basicly any other file you know you won't need and simply re-opening the project. usually helps for me.

Share this post


Link to post
Share on other sites
kusma has the right idea...

ALSO: Just some comments about your program...



When you do this in WM_CREATE

HDC hdc = GetDC(hwnd);

you should also call

ReleaseDC(hwnd,hdc);

You also don't need two "PostQuitMessage(0)" calls. That may in fact be screwing things up. Try removing the one on WM_CLOSE. You aren't processing WM_CLOSE anyway.... if you allow it to fall through, DefWindowProc() will call DestroyWindow() automatically.

Share this post


Link to post
Share on other sites
PostQuitMessage(0); will send the WM_QUIT mesage to your message callback, not a good idea

PostQuitMessage is for when you have a message pump in your winmain and you check for the wm_quit message to end your message pump, in like games etc where a continous execution loop is in the winmain and checking for WM_QUIT is used to know when to terminate that loop.

you should allow WM_CLOSE to pass to defwinproc because you not using it
unless like i said above

Share this post


Link to post
Share on other sites

This topic is 4485 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this