定制全屏窗口:
/* 定制全屏窗口 */
SHINITDLGINFO shidi;
HWND hDlg = m_hWnd;
// Create a Done button and size it.
shidi.dwMask = SHIDIM_FLAGS;
shidi.dwFlags = SHIDIF_FULLSCREENNOMENUBAR;
shidi.hDlg = hDlg;
::SHInitDialog(&shidi);
/* 隐藏键盘 */
HWND hWnd = ::FindWindow( _T( "MS_SIPBUTTON" ), NULL );
if (hWnd == NULL)
{
return FALSE;
}
::ShowWindow( hWnd, SW_HIDE );
定制菜单栏:
方法(1)
SHMENUBARINFO mbi;
// 初始化menubar结构
memset(&mbi, 0, sizeof(SHMENUBARINFO));
mbi.cbSize = sizeof(SHMENUBARINFO); //必须填充
mbi.hwndParent = m_hWnd;
mbi.nToolBarId = IDR_MAINMENU; //菜单ID
mbi.dwFlags = SHCMBF_COLORBK | SHCMBF_HMENU | SHCMBF_HIDESIPBUTTON; //隐藏输入法
mbi.hInstRes = AfxGetInstanceHandle();
// 建立menubar控制
if (!SHCreateMenuBar(&mbi))
{
AfxMessageBox(_T( "建立menubar失败 "), MB_OK|MB_ICONSTOP);
DestroyWindow();
}
方法(2)
/* 系统定义的菜单 */
if (!m_wndCommandBar.Create(this) ||
!m_wndCommandBar.InsertMenuBar(IDR_MAINFRAME) ||
!m_wndCommandBar.AddAdornments(dwAdornmentFlags))
{
TRACE0("Failed to create CommandBar/n");
return -1; // fail to create
}
m_wndCommandBar.SetBarStyle(m_wndCommandBar.GetBarStyle() | CBRS_SIZE_FIXED);