WS_CHILD and CWnd
Ray Marshall -- ray@newton.apple.com Saturday, January 20, 1996 Hello, I am trying to create a CWnd object with the WS_CHILD style. For some reason when I do this, the Window doesn't show. It's invisible. If I use the WS_POPUP style, then everything works (except I don't have the desired child behaivor). This is what I am doing: // create the CWnd object pWnd = new CMyCwnd; pWnd->Create( ownerWnd ); pWnd->ShowWindow( SW_SHOW ); pWnd->UpdateWindow(); // my derived Create method BOOL CMyCwnd::Create( CWnd *pParent ) { CString classname; classname = AfxRegisterWndClass( CS_DBLCLKS ); if ( !CWnd::CreateEx( WS_EX_TOPMOST | WS_EX_TOOLWINDOW, classname, "MyWnd", WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_BORDER | WS_DLGFRAME | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME, 10, 10, 300, 400, pParent->GetSafeHwnd(), NULL )) { TRACE0("Warning: creation of CMyWnd failed\n"); return FALSE; } return TRUE; } I have tried every thing I can think of to get this too work but figure I am missing the obvious. I orginally was using a modeless dialog but that had the exact same problem. Any help would be greatly appreciated! Thanks, //Ray
John & Annette Elsbree -- elsbree@msn.com Tuesday, January 23, 1996 Ray - I think you're trying to use a combination of flags that isn't permitted by Windows. I'm not sure the documentation explicitly says it anywhere, but common sense would dictate that some of these flags just aren't compatible with the WS_CHILD style. In particular, WS_EX_TOPMOST and WS_EX_TOOLWINDOW definitely aren't intended for use with child windows. The documentation *does* explicitly forbid at least one pair of flags that you're using together: 7 WS_CAPTION Creates a window that has a title bar (implies the WS_BORDER style). Cannot be used with the WS_DLGFRAME style. I don't know exactly what you're trying to do here, but good luck with it! mfcTeam.m_johnels; // does not represent Microsoft ---------- From: owner-mfc-l@netcom.com on behalf of Ray Marshall if ( !CWnd::CreateEx( WS_EX_TOPMOST | WS_EX_TOOLWINDOW, classname, "MyWnd", WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_BORDER | WS_DLGFRAME | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME, 10, 10, 300, 400, pParent->GetSafeHwnd(), NULL ))
| Вернуться в корень Архива |