CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2011
    Posts
    3

    [RESOLVED] SendMessage fails with WM_MDICREATE

    Hi all:

    I've been debugging with my MDI app for one bug:

    Code:
            MDICREATESTRUCT mcs;
    	HWND hChild;
    
    	mcs.szTitle = L"[Untitled]";
    	mcs.szClass = MDI_CHILD_WND_NAME;
    	mcs.hOwner  = GetModuleHandle(NULL);
    	mcs.x = mcs.cx = CW_USEDEFAULT;
    	mcs.y = mcs.cy = CW_USEDEFAULT;
    	mcs.style = MDIS_ALLCHILDSTYLES;
    
    	hChild = (HWND)SendMessage(hMDIClient, WM_MDICREATE, 0, (LONG)&mcs);
    	if(hChild == NULL)
    	{
    		MessageBox(hMDIClient, L"Failed to create MDI Child", L"Error",
    			MB_ICONEXCLAMATION | MB_OK);
    	}
    The MDI client window shows up correctly. I've also double checked hMDIClient is having the correct value, i.e. it is indeed the handle to the MDI client window. But why does it always fail to create MDI child window?

    I'm stuck on this single issue for more than 20 hours. Please help if you can!
    Thanks.

  2. #2
    Join Date
    Jun 2008
    Posts
    592

    Re: SendMessage fails with WM_MDICREATE

    You could try CreateMDIWindow and if it fails, call GetLastError() and look at the system error codes.
    0100 0111 0110 1111 0110 0100 0010 0000 0110 1001 0111 0011 0010 0000 0110 0110 0110 1111 0111 0010
    0110 0101 0111 0110 0110 0101 0111 0010 0010 0001 0010 0001 0000 0000 0000 0000
    0000 0000 0000 0000

  3. #3
    Join Date
    Jul 2011
    Posts
    3

    Re: SendMessage fails with WM_MDICREATE

    Thanks for the reply.
    I've got it sorted out. It was due to a silly mistake of mine in another place of the code.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured