Thread: How can create MDI Child window without MAXIMIZEBOX

  1. #1
    Registered User
    Join Date
    Dec 2007
    Posts
    6

    How can create MDI Child window without MAXIMIZEBOX

    I want to create MDI Child window without MAXIMIZEBOX and MINIMIZEBOX and un-sizable.

    Following is the code I used, It always give me the maximizeBox and MinimizeBox at title box right corner. but I don't want them. Anyone can give me a help.

    //
    clientcreate.hWindowMenu = hMenuStandardWindow ;
    clientcreate.idFirstChild = IDM_FIRSTCHILD ;

    hwndClient = CreateWindowEx (0,TEXT ("MDICLIENT"), NULL,
    WS_CHILD | WS_CLIPCHILDREN | WS_VISIBLE,
    0, 0, 0, 0, hwnd, (HMENU) 1, hInst,
    (PSTR) &clientcreate) ;

    mdicreate.szClass = szWelcomeClass ;
    mdicreate.szTitle = TEXT ("Welcome") ;
    mdicreate.hOwner = hInst ;
    mdicreate.x = CW_USEDEFAULT ;
    mdicreate.y = CW_USEDEFAULT ;
    mdicreate.cx = 598;//CW_USEDEFAULT ;
    mdicreate.cy = 474;//CW_USEDEFAULT ;
    mdicreate.style = 0 ;
    mdicreate.lParam = 0 ;

    //hwndChild
    hwndWelcome= (HWND) SendMessage (hwndClient,
    WM_MDICREATE, 0,
    (LPARAM) (LPMDICREATESTRUCT) &mdicreate) ;


    Thanks!

  2. #2
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Posts
    3,210
    I think you can OR with ~WS_MINIMIZEBOX and ~WS_MAXIMIZEBOX.

  3. #3
    Registered User
    Join Date
    Dec 2007
    Posts
    6
    Thanks for your reply, but it seems this is not the fix, I try to put | ~WS_MAXIMIZEBOX | ~WS_MINIMIZEBOX in 3 windows style, it hided the window.

    I have read through the msdn, did not find a solution to get rid of the child window's MaximizeBox.

  4. #4
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Posts
    3,210
    You tried this?

    Code:
    ...
    
    hwndClient = CreateWindowEx (0,TEXT ("MDICLIENT"), NULL,
    WS_CHILD | WS_CLIPCHILDREN | WS_VISIBLE | ~WS_MINIMIZEBOX | ~WS_MAXIMIZEBOX, 
    0, 0, 0, 0, hwnd, (HMENU) 1, hInst,
    (PSTR) &clientcreate) ;
    
    ...

  5. #5
    Registered User
    Join Date
    Dec 2007
    Posts
    6
    Yes, I tried twice, it hides the Client Window, and all child windows can't display.

    I programing with Win32 API, it seem MFC can do that way you suggested.

  6. #6
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Posts
    3,210
    Reading at MSDN shows that MDI applications have three types:

    • Frame
    • Client
    • Child


    Which one are you trying to get rid of the minimize and maximize boxes?

    http://msdn2.microsoft.com/en-us/library/ms697533.aspx

    I'm not sure if you can edit it for a Client type.

  7. #7
    Registered User
    Join Date
    Dec 2007
    Posts
    6
    I want to get rid of Child window's MAXIMIZEBOX and MINIMIZEBOX. Thanks.

  8. #8
    Registered User
    Join Date
    Mar 2005
    Location
    Mountaintop, Pa
    Posts
    1,058

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. 6 measly errors
    By beene in forum Game Programming
    Replies: 11
    Last Post: 11-14-2006, 11:06 AM
  2. how i create a window whith all it's elements
    By rasheed in forum Windows Programming
    Replies: 1
    Last Post: 05-31-2006, 06:53 PM
  3. Posting a message to a child window
    By axr0284 in forum Windows Programming
    Replies: 6
    Last Post: 01-27-2005, 09:35 AM
  4. 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
  5. Default Procedure for MDI Child Window?
    By SeanMSimonsen in forum Windows Programming
    Replies: 3
    Last Post: 04-05-2003, 05:43 PM