-1

I would like to have thin child frame borders in my MFC/MDI application. Microsoft suggests changing window styles in PreCreateWindow function and it seems like proper window style is WS_BORDER. However something like this doesn't work;

BOOL CChildFrame::PreCreateWindow(CREATESTRUCT& cs)
{
    cs.style |= WS_BORDER;
    return CMDIChildWnd::PreCreateWindow(cs);
} 

What am I missing here?

Thanks

8
  • 2
    Assuming you are trying to add the style to the existing ones, it should be |=.
    – user2100815
    Commented Jun 9, 2017 at 19:43
  • Sorry for the typo. Yes that's what I meant. It doesn't change the behavior.
    – cbr
    Commented Jun 9, 2017 at 20:39
  • You may need to remove other border styles.
    – user2100815
    Commented Jun 9, 2017 at 20:51
  • I tried removing individually or combination of WS_CAPTION, WS_DLGFRAME, WS_SIZEBOX, WS_THICKFRAME and so on. If you can give me a specific suggestion that would help better. Thanks.
    – cbr
    Commented Jun 9, 2017 at 21:27
  • 1
    An MDI child window must always have a fat border. MDI child windows need to be resizable, that's what the windowing model looks like. Well, looked like :) Commented Jun 12, 2017 at 7:24

1 Answer 1

0

You can try something like this:

BOOL CChildFrame::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
//  the CREATESTRUCT cs

cs.style = WS_CHILD | WS_VISIBLE | WS_BORDER;

if(! CMDIChildWnd::PreCreateWindow(cs))
    return FALSE;

return TRUE;
}
1
  • "WS_CHILD | WS_VISIBLE | WS_BORDER" style doesn't show Child window as a window. It looks like it's embedding it.
    – cbr
    Commented Jun 12, 2017 at 13:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.