我有一个对话框,他的style 是child,但我想把弄成一个popup的弹出窗口,我在这个类的OnInitDialog里面加了修改语句。
ModifyStyle(WS_CHILD, WS_POPUP);
其他代码不变。但这样的效果与我直接把style改为popup的效果不一样,动态修改的对话框会被父窗口给覆盖,但其实它的属性已经是ws_popup了,求大神指点

解决方案 »

  1.   

        CRect rect;
        GetWindowRect(&rect);
        ModifyStyle(WS_CHILD,WS_POPUP);
        MoveWindow(&rect);
        SetParent(NULL);
    试试
      

  2.   

    子对话框在调用SetParent();试试
      

  3.   


    ModifyStyle(WS_CHILD, WS_POPUP);
    SetParent(GetDesktopWindow());
      

  4.   

    For compatibility reasons, SetParent does not modify the WS_CHILD or WS_POPUP window styles of the window whose parent is being changed. Therefore, if hWndNewParent is NULL, you should also clear the WS_CHILD bit and set the WS_POPUP style after calling SetParent. Conversely, if hWndNewParent is not NULL and the window was previously a child of the desktop, you should clear the WS_POPUP style and set the WS_CHILD style before calling SetParent. 
      

  5.   

    英语水平不行,用google翻译了下,感觉意思不对,求指教
      

  6.   

    我现在的问题是资源视图里面对话框的样式是child,我创建的时候在它的OnInitDlg里面加了
    ModifyStyle(WS_CHILD, WS_POPUP);
    SetParent(NULL);但这样之后对话框在任务栏上有图标显示,而且也不随父窗口的最小化而最小化~
    谁知道怎么解决么
      

  7.   


    由于兼容性的原因, SetParent不能改变样式WS_CHILD or WS_POPUP,当他的parent改变时,如果hWndNewParent 为NULL ,你应该先调用setParent为NULL,然后在调用ModifyStyle.,
    如果hWndNewParent不为NULL ,并且window是桌面窗口的child,你应该先调用ModifyStyle,在调用setParent.你是不是顺序写的不对