如何将view改成桌面?即去掉菜单、工具条、标题栏、边框。
解决方案 »
- vc 按钮放到msflexgrid表格控件里,按钮消息响应不了?谢谢
- 求人帮忙写代码!有偿!
- 使用双缓冲中的错误
- 大家看看这个向CcomboEx中添加图标的代码有什么问题~~~
- 高手看看这是什么错误?
- 我怎么阻塞式的调用一个外部程序(如udl文件),外部程序(udl文件)关闭了,函数才返回。
- 怎样读取word、excel、powerpoint、flash等文件的里的各种属性
- 新手对COM的认识及疑惑,敬请指点,来者有分
- 如何是CListbox可以多选。
- VC菜鸟问题
- 向高手请教 #define DECLARE_VTBL(iname) iname vt##iname; 中## 的作用是什么??
- SDI中,分割窗口如何与工具条联系起来?
<<另一种全屏显示方法(隐藏菜单标题条)>>1.Declare:
class CMainFrame : public CMDIFrameWnd
{
// Attributes
public:
CMenu m_OrgMenu;
bool m_bFullScreenMode;
private:
// used for full-screen mode
bool m_bStatusBarWasVisible,m_bToolBarWasVisible;
CRect m_mainRect;
CToolBar* m_pwndFullScreenBar;
bool m_bChildMax;
// Operations
public:
void FullScreenModeOn();
void FullScreenModeOff();
}2.打开全屏:
void CMainFrame::FullScreenModeOn()
{
CMDIChildWnd* pChild=MDIGetActive();
if(!pChild) return; m_bToolBarWasVisible=(m_wndToolBar.IsWindowVisible()!=0);//工具条
m_wndToolBar.ShowWindow(SW_HIDE); m_bStatusBarWasVisible=(m_wndStatusBar.IsWindowVisible()!=0);//状态条
m_wndStatusBar.ShowWindow(SW_HIDE); //浮动工具条(全屏状态)
m_pwndFullScreenBar=new CToolBar;
m_pwndFullScreenBar->Create(this);
m_pwndFullScreenBar->LoadToolBar(IDR_FULLSCREEN);
m_pwndFullScreenBar->SetBarStyle(m_pwndFullScreenBar->GetBarStyle() |
CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC);
m_pwndFullScreenBar->ModifyStyle(0, TBSTYLE_FLAT);
m_pwndFullScreenBar->EnableDocking(0); CPoint pt(300,200);//// place the full-screen off button somewhere:
FloatControlBar(m_pwndFullScreenBar,pt);
// now save the old positions of the main and child windows
GetWindowRect(&m_mainRect); //隐藏标题条
LONG style=::GetWindowLong(m_hWnd,GWL_STYLE);
style&=~WS_CAPTION;
::SetWindowLong(m_hWnd,GWL_STYLE,style);
int screenx=GetSystemMetrics(SM_CXSCREEN);
int screeny=GetSystemMetrics(SM_CYSCREEN);
// resize:
SetWindowPos(NULL,0,0,screenx,screeny,SWP_NOZORDER);
style=::GetWindowLong(pChild->m_hWnd,GWL_STYLE);
m_bChildMax=(style & WS_MAXIMIZE)?true:false;
// note here: m_bMainMax is not needed since m_hWnd only changed its caption...
//隐藏菜单及保存老菜单
ASSERT(m_OrgMenu.GetSafeHmenu()==NULL);
CMenu* pOldMenu=GetMenu();
m_OrgMenu.Attach(pOldMenu->Detach());
SetMenu((CMenu*)NULL);
// and maximize the child window it will remove its caption, too.
this->ShowWindow (SW_SHOWMAXIMIZED);
style=::GetWindowLong(pChild->m_hWnd,GWL_STYLE);
style&=~WS_CAPTION;
::SetWindowLong(pChild->m_hWnd,GWL_STYLE,style);
pChild->ShowWindow(SW_SHOWMAXIMIZED); m_bFullScreenMode=true;
}void CMainFrame::FullScreenModeOff()
{
ASSERT(m_OrgMenu.GetSafeHmenu()!=NULL);
SetMenu(&m_OrgMenu);//恢复菜单
m_OrgMenu.Detach(); delete m_pwndFullScreenBar;//删除浮动工具条(全屏)
LONG style=::GetWindowLong(m_hWnd,GWL_STYLE);
style|=WS_CAPTION;
::SetWindowLong(m_hWnd,GWL_STYLE,style);
if(m_bToolBarWasVisible)
m_wndToolBar.ShowWindow(SW_SHOW);
if(m_bStatusBarWasVisible)
m_wndStatusBar.ShowWindow(SW_SHOW);
MoveWindow(&m_mainRect);
RecalcLayout();
CMDIChildWnd* pChild=MDIGetActive(); style=::GetWindowLong(pChild->m_hWnd,GWL_STYLE);
style|=WS_CAPTION;//恢复标题条
::SetWindowLong(pChild->m_hWnd,GWL_STYLE,style);
if(pChild)
{
if(m_bChildMax)
MDIMaximize(pChild);
else MDIRestore(pChild);
}
m_bFullScreenMode=false;
}二》HKEY_LOCALMACHINE\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon
中,"Shell"=yourApp.exe
CXXXView* m_pMyView;//in App.hApp.cpp
Init:
m_pMyView = (CXXXView)RUNTIME_CLASS(CXXXView)->CreateObject();
m_pMyView->Create(...);//自己看一下MSDN,不要加WS_CHILD的风格
m_pMyView->ShowWindow(SW_SHOW);
m_pMainWnd = m_pMyView;
你的方法不错,但有细微的边框。能解决吗?