MDI window creation

This is a discussion on MDI window creation within the Windows Programming forums, part of the Platform Specific Boards category; I have an MDI interface and one of my windows creates, whenever I try to create another it fails to ...

  1. #1
    Registered User
    Join Date
    May 2002
    Posts
    132

    MDI window creation

    I have an MDI interface and one of my windows creates, whenever I try to create another it fails to create it. How do you find out what the error was, like why it didn't create the window, when you are using SendMessage(g_hMDIClient, WM_MDICREATE, 0, (LONG)&mcs);? All this message seems to return is NULL for failure or the handle to the new window created. Seems to be no in between, GetLastError() returned 0. I've even tried calling CreateMDIWindow() and I get the same response from the GetLastError() call.

    Code:
    // creates a channel window
    void CreateChannelWnd(TCHAR *chan)
    {
    	CHANNEL *channel;
    	int err;
    	MDICREATESTRUCT mcs;
    	TCHAR buffer[201];
    
    	mcs.szTitle = chan;
    	mcs.szClass = g_szChild;
    	mcs.hOwner = g_hInst;
    	mcs.x = CW_USEDEFAULT;
    	mcs.cx = 600;
    	mcs.y = CW_USEDEFAULT;
    	mcs.cy = 500;
    	mcs.style = MDIS_ALLCHILDSTYLES;
    
    	channel = LoadChan(chan);
    	if( channel == NULL ) {
    		AppendText(status.Display, COLOR_RED, "\nERROR: Unable to read in channel data file.");
    		SendPart(chan);
    		return;
    	}
    	else {
    		channel->hWnd = CreateMDIWindow(g_szChild, chan, MDIS_ALLCHILDSTYLES, CW_USEDEFAULT, CW_USEDEFAULT, 600, 500, g_hMDIClient, g_hInst, 0);
    		if( channel->hWnd == NULL ) {
    			SendPart(chan);
    			err = GetLastError();
    			sprintf(buffer, "\nERROR: Unable to create channel window. (%d)", err);
    			AppendText(status.Display, COLOR_RED, buffer);
    			AddError();
    			return;
    		}
    		ShowWindow(g_hMDIClient, SW_SHOW);
    	}
    }

  2. #2
    Registered User
    Join Date
    May 2002
    Posts
    132
    ooops, forgot to mention that the MDICREATESTRUCT isn't used, I just haven't removed it yet while I'm trying to figure out why it isn't working

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Just starting Windows Programming, School me!
    By Shamino in forum Windows Programming
    Replies: 17
    Last Post: 02-22-2008, 07:14 AM
  2. WM_CAPTION causing CreateWindowEx() to fail.
    By Necrofear in forum Windows Programming
    Replies: 8
    Last Post: 04-06-2007, 08:23 AM
  3. 6 measly errors
    By beene in forum Game Programming
    Replies: 11
    Last Post: 11-14-2006, 10:06 AM
  4. OpenGL Window
    By Morgul in forum Game Programming
    Replies: 1
    Last Post: 05-15-2005, 12:34 PM
  5. OpenGL and Windows
    By sean345 in forum Game Programming
    Replies: 5
    Last Post: 06-24-2002, 10:14 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21