Advertisement

simple question (I think) :D

Started by March 03, 2002 10:50 AM
1 comment, last by da_cobra 22 years, 8 months ago
I have a simple question (I think) I have the following procedure before my winmain and I just create a simple window now when I add that WM_CREATE, my application immediatly exits and if I leave that WM_CREATE out of my procedure it displays my window normal, how does this come?
  
LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
    switch(msg)
    {
		case WM_CREATE:
		{
		//	WndGlobals WinGlobals ;

		}

		case WM_CLOSE:
            DestroyWindow(hwnd) ;
        break ;

        case WM_DESTROY:
            PostQuitMessage(0) ;
        break ;
        
		default:
            return DefWindowProc(hwnd, msg, wParam, lParam);
    }
    return 0;
}

  
Edited by - da_cobra on March 3, 2002 11:53:41 AM
You're falling through the cases from WM_CREATE to WM_CLOSE and that's causing the window to close as soon as it's created. Put a break where indicated you should be ok.
    LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam){    switch(msg)    {        case WM_CREATE:	{  	//	WndGlobals WinGlobals ;	}// PUT A BREAK HEREbreak; 	case WM_CLOSE:            DestroyWindow(hwnd) ;            break ;        case WM_DESTROY:            PostQuitMessage(0) ;            break ;        	default:            break ;    }    return DefWindowProc(hwnd, msg, wParam, lParam);}    




Edited by - lessbread on March 3, 2002 12:04:15 PM
"I thought what I'd do was, I'd pretend I was one of those deaf-mutes." - the Laughing Man
Advertisement
ah damn, I knew it was something small

thanx alot!!!

This topic is closed to new replies.

Advertisement