如何通过代码设置对话框的WS_CHILD或者WS_POPUP

flashzf 2006-03-14 06:06:29
我想创建非模态对话框.但是需要根据情况来确定是POPUP还是CHILD.
由于PreCreateWindow消息不响应.
我用CreateIndirect(),但是不成功,我也不清楚原因.
最好有例子代码.
...全文
460 6 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
xing_xing_xing 2006-03-16
  • 打赏
  • 举报
回复
先创建对话框,然后更改风格
CMyDlg *pDlg = new CMyDlg();
pDlg->Create(ID_DIALOG,this);
pDlg->ModifyStyle(WS_CHILD,0);
lamputa_lito 2006-03-16
  • 打赏
  • 举报
回复
更简单的是用ModifyStyle()
dnliophsam 2006-03-15
  • 打赏
  • 举报
回复
学习
liutaoxwl 2006-03-15
  • 打赏
  • 举报
回复
DWORD dwStyle = GetWindowLong(hWnd,GWL_STYLE);
if(dwStyle && WS_CHILD)
{
dwStyle &= ~WS_CHILD;// 去掉WS_CHILD风格
dwStyle |= WS_POPUP;// 设置WS_POPUP风格
}
else
{
dwStyle &= ~WS_POPUP;
dwStyle |= WS_CHILD;
}
SetWindowLong(hWnd,GWL_STYLE,dwStyle);
handsomerun 2006-03-15
  • 打赏
  • 举报
回复
可以用setwindowlong重新设置窗口的style
flashzf 2006-03-15
  • 打赏
  • 举报
回复
HELP!
MFC开发过程序所需的ModifyStyle(needDelStyle,needAddStyle,SWP_FRAMECHANGED); Sytel: WS_BORDER Creates a window that has a border. WS_CAPTION Creates a window that has a title bar (implies the WS_BORDER style). Cannot be used with the WS_DLGFRAME style. WS_CHILD Creates a child window. Cannot be used with the WS_POPUP style. WS_CHILDWINDOW Same as the WS_CHILD style. WS_CLIPCHILDREN Excludes the area occupied by child windows when you draw within the parent window. Used when you create the parent window. WS_CLIPSIBLINGS Clips child windows relative to each other; that is, when a particular child window receives a paint message, the WS_CLIPSIBLINGS style clips all other overlapped child windows out of the region of the child window to be updated. (If WS_CLIPSIBLINGS is not given and child windows overlap, when you draw within the client area of a child window, it is possible to draw within the client area of a neighboring child window.) For use with the WS_CHILD style only. WS_DISABLED Creates a window that is initially disabled. WS_DLGFRAME Creates a window with a double border but no title. WS_GROUP Specifies the first control of a group of controls in which the user can move from one control to the next with the arrow keys. All controls defined with the WS_GROUP style FALSE after the first control belong to the same group. The next control with the WS_GROUP style starts the next group (that is, one group ends where the next begins). WS_HSCROLL Creates a window that has a horizontal scroll bar. WS_ICONIC Creates a window that is initially minimized. Same as the WS_MINIMIZE style. WS_MAXIMIZE Creates a window of maximum size. WS_MAXIMIZEBOX Creates a window that has a Maximize button. WS_MINIMIZE Creates a window that is initially minimized. For use with the WS_OVERLAPPED style only. WS_MINIMIZEBOX Creates a window that has a Minimize button. WS_OVERLAPPED Creates an overlapped window. An overlapped window usually has a caption a

15,978

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 界面
社区管理员
  • 界面
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧