分类: 嵌入式
2010-08-10 13:33:59
|
2,以下代码是mfc的全屏代码。
//全屏显示
m_bFullScreen = FALSE;
CDialog::OnInitDialog();//注意该句,是对话框初始化函数里面的。如果之前有重复的该句的话,就会发现输入法总是不能隐藏。不能实现全屏。
// Call SHInitDialog with flags for full screen.
SHINITDLGINFO shidi;
// ::SHDoneButton(m_hWnd,SHDB_SHOW);// 该句注释掉之后右上角按钮变成叉
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);
这段代码主要来自:http://www.cppblog.com/gtwdaizi/articles/49723.html
他的对话框右上角是隐藏按钮。
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 )
{
}