|
在“CWnd::CreateEx”创建窗体时,WS_POPUP 和 WS_CHILD 是不能同时使用的,
只有创建时才可能设置这MS说的。
而你现在要弹出窗体改为子窗体,是同样 的道理的。
如果你非要,那给你一段VC中的参考代码,
对话框在WS_POPUP与WS_CHILD之间转换(原创)
BOOL Create( UINT nIDTemplate,CWnd* pParentWnd );
BOOL CChildDialog::Create( UINT nIDTemplate,CWnd* pParentWnd )
{
HINSTANCE hInst = AfxFindResourceHandle( MAKEINTRESOURCE( nIDTemplate ), RT_DIALOG);
HRSRC hResource = ::FindResource(hInst,MAKEINTRESOURCE( nIDTemplate ), RT_DIALOG);
HGLOBAL hTemplate = LoadResource(hInst, hResource);
ASSERT( hTemplate );
LPCDLGTEMPLATE lpDialogTemplate = ( LPCDLGTEMPLATE )LockResource( hTemplate );
ASSERT( lpDialogTemplate );
DWORD *ptrStyle = ( DWORD* )&lpDialogTemplate->style;
*ptrStyle &= ~( WS_OVERLAPPEDWINDOW|WS_POPUPWINDOW );
*ptrStyle |= WS_CHILDWINDOW;
UnlockResource( hTemplate );
BOOL bResult = CreateIndirect(hTemplate, pParentWnd, hInst);
FreeResource(hTemplate);
return bResult;
}
MSDN中的资料:
WS_POPUP Creates a pop-up window. Cannot be used with the WS_CHILD style.
WS_CHILD Creates a child window. Cannot be used with the WS_POPUP style.
|
|