MFC窗口设置TopMost置顶的几种方法
清泛原创
方法一:网上常见的
pDlg->SetWindowPos(&CWnd::wndTopMost, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); 或
pDlg->SetWindowPos(pDlg->GetStyle() & WS_EX_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
方法二:修改rc文件
IDD_xxx_DIALOG DIALOG 0, 0, 100, 60
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_TOPMOST
CAPTION "xxxx"
pDlg->SetWindowPos(&CWnd::wndTopMost, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); 或
pDlg->SetWindowPos(pDlg->GetStyle() & WS_EX_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
方法二:修改rc文件
IDD_xxx_DIALOG DIALOG 0, 0, 100, 60
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_TOPMOST
CAPTION "xxxx"