1. 完全全屏
在OnInitDialog() 方法中调用如下代码:
m_bFullScreen = FALSE;
CDialog::OnInitDialog();
// Call SHInitDialog with flags for full screen.
SHINITDLGINFO shidi;
shidi.dwMask = SHIDIM_FLAGS;
shidi.dwFlags = SHIDIF_FULLSCREENNOMENUBAR;
shidi.hDlg = m_hWnd;
::SHInitDialog(&shidi);
// TODO: Add extra initialization here.
//::CommandBar_Show(m_pWndEmptyCB->m_hWnd, FALSE);
// SHFullScreen fails if dialog box is not foreground.
SetForegroundWindow();
SHFullScreen(m_hWnd, SHFS_HIDETASKBAR | SHFS_HIDESIPBUTTON);
// Resize the window over the taskbar area.
#define MENU_HEIGHT 26
RECT rect;
GetWindowRect(&rect);
rect.top -= MENU_HEIGHT;
MoveWindow(&rect, TRUE);
上面一段代码可以实现完全的全屏, 但是我使用的过程中发现对话框的标题栏消失了..不知道为什么..
2. 客户区全屏
CHikConfigDlg configDlg;
CRect rc;
SetRect( &rc, 0, 0, GetSystemMetrics( SM_CXSCREEN ), GetSystemMetrics( SM_CYSCREEN ) );
// 用来隐藏菜单栏的
//HWND hCommandBarWnd = ::FindWindowW( _T("menu_worker"), NULL );
//::CommandBar_Show(hCommandBarWnd, FALSE);
::SHFullScreen( configDlg.m_hWnd, SHFS_HIDETASKBAR | SHFS_HIDESTARTICON | SHFS_HIDESIPBUTTON );
::MoveWindow( configDlg.m_hWnd, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, FALSE );
INT_PTR nResponse = configDlg.DoModal();
if ( nResponse == IDOK )
{
}
调用上面一段代码, 创建的CHikConfigDlg 对话框就是在客户区内全屏的.