如何将view改成桌面?即去掉菜单、工具条、标题栏、边框。

解决方案 »

  1.   

    一fullsrceen全屏
     <<另一种全屏显示方法(隐藏菜单标题条)>>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
      

  2.   

    就象建立一个一般的WINDOWS一样:
    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;
      

  3.   

    TO  NewFree(新自由人)
    你的方法不错,但有细微的边框。能解决吗?