Thread: Default Procedure for MDI Child Window?

  1. #1
    Registered User
    Join Date
    Nov 2002
    Posts
    18

    Default Procedure for MDI Child Window?

    Could anyone tell me what the default procedure is for a child window in an mdi application? My group at school is making a finance mangagement program, and my part is to do a calendar, and the calendar is made of 35 (7 days * 5 weeks) child windows (days), but I don't know how to let them be processed by default.
    I have tried DefWindowProc and DefMDIChildProc (which is what I use for the calendar window). I at least assume this is the problem, but if that is the right procedure, then I'm doing something else wrong. What happens is two things: When the calendar window starts out it doesn't draw the days, when it gets maximized it doesn't draw the days whether they were drawn before or not, when it is resized it works fine, and when it closes it eats all my cpu time and I have to close it with task manager.

    Thank you for reading this.
    ~Sean Michael Simonsen

  2. #2
    Registered User
    Join Date
    Nov 2002
    Posts
    18

    Here's the code, btw...

    Code:
    LRESULT CALLBACK DayWndProc( HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam )
    {
    	HDC hdc;
    	PAINTSTRUCT ps;
    	RECT rect;
    
    	switch( message )
    	{
    	case WM_PAINT:
    		hdc = BeginPaint( hwnd, &ps );
    		GetClientRect( hwnd, &rect );
    		Rectangle( hdc, 0, 0, rect.right, rect.bottom );
    		EndPaint( hwnd, &ps );
    		return( 0 );
    	}
    	return DefMDIChildProc( hwnd, message, wParam, lParam );
    }
    ~Sean Michael Simonsen

  3. #3
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    >>Could anyone tell me what the default procedure is for a child window in an mdi application?<<

    DefMDIChildProc.

    >>but if that is the right procedure, then I'm doing something else wrong.<<

    Are you using 'DefFrameProc' for default handling for the frame window (ie the parent of the mdiclient window. The mdiclient window should be the parent of your mdichild window(s) )? If not then some messages intended for the mdiclient (ie the parent of your mdichild windows) will not work as expected. It's particularly important to call DefFrameProc if you're handling WM_COMMAND for the frame wnd.

    Does your drawing code exhibit the same problems when run in a single, non-mdi window?

  4. #4
    Registered User
    Join Date
    Nov 2002
    Posts
    18
    Your advice of running it as non-mdi helped me out a lot, thank you. I realized that the problem was I had commented out a couple lines that I didn't need before, and I forgot to put them back when I needed them. Almost every time I have great difficulty with a project, I later realize what a complete dumbass I am. You really helped me to narrow down the bad code, though.
    Thank you.
    ~Sean Michael Simonsen

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Button positioning
    By Lionmane in forum Windows Programming
    Replies: 76
    Last Post: 10-21-2005, 05:22 AM
  2. Window scrollbar
    By maxorator in forum Windows Programming
    Replies: 2
    Last Post: 10-07-2005, 12:31 PM
  3. Adding colour & bmps to a Win 32 Window??
    By carey_sizer in forum Windows Programming
    Replies: 4
    Last Post: 09-04-2004, 05:55 PM
  4. buttons won't work when in child window!?
    By psychopath in forum Windows Programming
    Replies: 5
    Last Post: 06-17-2004, 02:18 PM
  5. problem with open gl engine.
    By gell10 in forum Game Programming
    Replies: 1
    Last Post: 08-21-2003, 04:10 AM