[原创] wince自带shell和任务栏的隐藏

Wince.Android   2013-4-24 09:02 楼主
C:\WINCE600\PUBLIC\SHELL\OAK\HPC\EXPLORER\MAIN\desktop.cpp

bool CDesktopWnd::Create()
{

    IShellFolder    *pSHF;
    FOLDERSETTINGS fs;
    RECT rc;
    HRESULT hr = E_FAIL;

    // Get a shell folder for the desktop
    hr = SHGetDesktopFolder(&pSHF);
    if(hr || !pSHF)
        goto Cleanup;

    // create a shell view for it
    hr = pSHF->CreateViewObject(NULL, IID_IShellView, (LPVOID *)&_psv);
    if(hr || !_psv)
        goto Cleanup;

    fs.ViewMode = FVM_ICON;
    fs.fFlags = FWF_DESKTOP | FWF_ALIGNLEFT | FWF_NOSCROLL;

    //++changed by hjb
    //将Desktop的窗口大小设为0
    //SetRect(&rc, 0, 0, GetSystemMetrics(SM_CXVIRTUALSCREEN), GetSystemMetrics(SM_CYVIRTUALSCREEN));
    SetRect(&rc, 0, 0, 0, 0);
        //--changed by hjb

    // create the desktop's view window (no need to AddRef since CreateViewWindow does it)
    hr = _psv->CreateViewWindow(NULL,  &fs, (IShellBrowser *)this, &rc, &_hWnd);
    if(hr || !_hWnd)
    {
        Release();
        goto Cleanup;
    }

    RegisterDesktop(_hWnd);

Cleanup:
    if(pSHF)
        pSHF->Release();

   return (hr == S_OK);   
}
        C:\WINCE600\PUBLIC\SHELL\OAK\HPC\EXPLORER\MAIN\explorer.cpp


DWORD WINAPI CreateTaskBar(LPVOID pEvent)
{
    HANDLE hSyncEvent = *((HANDLE *) pEvent);
    CTaskBar *pTaskBar = NULL;
    HWND hwndTB = NULL;

    pTaskBar = new CTaskBar;

    //++added by hjb
    //在创建任务栏时强制终止
    if(pTaskBar)
    {
        delete pTaskBar;
        SetEvent(hSyncEvent);
        return 0;
    }
    //--added by hjb

    if(!pTaskBar)
    {
        SetEvent(hSyncEvent);
        return 0;
    }

    g_TaskBar = pTaskBar;
    if(!pTaskBar->Register(g_hInstance))
    {
        g_TaskBar = NULL;
        delete pTaskBar;
        SetEvent(hSyncEvent);
        return 0;
    }

    RegisterTaskBar(pTaskBar->GetWindow());
    SetEvent(hSyncEvent);

    DWORD dwRet = pTaskBar->MessageLoop();

    delete pTaskBar;

    return dwRet;
}

http://www.cnblogs.com/we-hjb/archive/2008/12/28/1364070.html
完整原文地址

回复评论

暂无评论,赶紧抢沙发吧
电子工程世界版权所有 京B2-20211791 京ICP备10001474号-1 京公网安备 11010802033920号
    写回复