void CWin7::CreateTasksList() { if ( m_DestList ) { if ( m_List ) { IObjectCollection *poc; HRESULT hr = CoCreateInstance(CLSID_EnumerableObjectCollection, NULL, CLSCTX_INPROC, IID_PPV_ARGS(&poc)); if (SUCCEEDED(hr)) { IShellLink * psl; hr = _CreateShellLink("/Tab-Favs", L"Favourites", "Open Favourites Tab", &psl); if (SUCCEEDED(hr)) { hr = poc->AddObject(psl); psl->Release(); } hr = _CreateShellLink("/Tab-Internet", L"Internet", "Open Internet Tab", &psl); if (SUCCEEDED(hr)) { hr = poc->AddObject(psl); psl->Release(); } hr = _CreateShellLink("/Tab-Official", L"Official", "Open Official Tab", &psl); if (SUCCEEDED(hr)) { hr = poc->AddObject(psl); psl->Release(); } #ifndef _NO_HISTORY hr = _CreateShellLink("/Tab-History", L"History", "Open History Tab", &psl); if (SUCCEEDED(hr)) { hr = poc->AddObject(psl); psl->Release(); } #endif #ifndef _NO_LAN_MODE hr = _CreateShellLink("/Tab-Lan", L"LAN", "Open LAN Tab", &psl); if (SUCCEEDED(hr)) { hr = poc->AddObject(psl); psl->Release(); } #endif if (SUCCEEDED(hr)) { hr = _CreateSeparatorLink(&psl); if (SUCCEEDED(hr)) { hr = poc->AddObject(psl); psl->Release(); } } hr = _CreateShellLink("/Win-Settings", L"Settings", "Open the Settings dialog", &psl); if (SUCCEEDED(hr)) { hr = poc->AddObject(psl); psl->Release(); } hr = _CreateShellLink("/Win-Help", L"Help", "Get Help & Support and the forums", &psl); if (SUCCEEDED(hr)) { hr = poc->AddObject(psl); psl->Release(); } if (SUCCEEDED(hr)) { IObjectArray * poa; hr = poc->QueryInterface(IID_PPV_ARGS(&poa)); if (SUCCEEDED(hr)) { // Add the tasks to the Jump List. Tasks always appear in the canonical "Tasks" // category that is displayed at the bottom of the Jump List, after all other // categories. hr = m_DestList->AddUserTasks(poa); poa->Release(); } } poc->Release(); } } } }
void CWin7::CreateCustomList() { #ifndef _NO_HISTORY if ( m_DestList ) { if ( m_List ) { HRESULT hr = CoCreateInstance(CLSID_EnumerableObjectCollection, NULL, CLSCTX_INPROC, IID_PPV_ARGS(&m_CustomList)); if (SUCCEEDED(hr)) { IShellLink * psl; unsigned int uiMax = CMainWindow::m_uiHistoryServers; if ( uiMax > 5 ) uiMax = 5; unsigned int ui = 0, ui1 = 0; CHistoryServer* pHist = 0; CServers* pServer = 0; char szBuf[ 128 ] = { 0 }; wchar_t wszBuf[ 128 ] = { 0 }; while ( ( ui < MAX_SERVERS ) && ( ui1 < uiMax ) ) { pHist = CMainWindow::m_lHistoryServers[ ui ]; if ( pHist ) { pServer = pHist->GetServer(); if ( pServer ) { sprintf( szBuf, "lu://connect/%s:%u", pServer->GetServerIP(), pServer->GetServerPort() ); MultiByteToWideChar( CP_ACP, 0, pServer->GetServerName(), -1, wszBuf, strlen( pServer->GetServerName() )+1 ); hr = _CreateShellLink( szBuf, wszBuf, "", &psl); if (SUCCEEDED(hr)) { hr = m_CustomList->AddObject(psl); psl->Release(); } ++ui1; } } ++ui; } if (SUCCEEDED(hr)) { IObjectArray * poa; hr = m_CustomList->QueryInterface(IID_PPV_ARGS(&poa)); if (SUCCEEDED(hr)) { // Add the tasks to the Jump List. Tasks always appear in the canonical "Tasks" // category that is displayed at the bottom of the Jump List, after all other // categories. hr = m_DestList->AppendCategory( L"Recent Servers", poa); poa->Release(); } } } else m_CustomList = 0; } } #endif }
// Builds the collection of task items and adds them to the Task section of the Jump List. All tasks // should be added to the canonical "Tasks" category by calling ICustomDestinationList::AddUserTasks. HRESULT _AddTasksToList(ICustomDestinationList *pcdl) { IObjectCollection *poc; HRESULT hr = CoCreateInstance(CLSID_EnumerableObjectCollection, NULL, CLSCTX_INPROC, IID_PPV_ARGS(&poc)); if (SUCCEEDED(hr)) { IShellLink * psl; hr = _CreateShellLink(L"/Task1", L"Task 1", &psl); if (SUCCEEDED(hr)) { hr = poc->AddObject(psl); psl->Release(); } if (SUCCEEDED(hr)) { hr = _CreateShellLink(L"/Task2", L"Second Task", &psl); if (SUCCEEDED(hr)) { hr = poc->AddObject(psl); psl->Release(); } } if (SUCCEEDED(hr)) { hr = _CreateSeparatorLink(&psl); if (SUCCEEDED(hr)) { hr = poc->AddObject(psl); psl->Release(); } } if (SUCCEEDED(hr)) { hr = _CreateShellLink(L"/Task3", L"Task 3", &psl); if (SUCCEEDED(hr)) { hr = poc->AddObject(psl); psl->Release(); } } if (SUCCEEDED(hr)) { IObjectArray * poa; hr = poc->QueryInterface(IID_PPV_ARGS(&poa)); if (SUCCEEDED(hr)) { // Add the tasks to the Jump List. Tasks always appear in the canonical "Tasks" // category that is displayed at the bottom of the Jump List, after all other // categories. hr = pcdl->AddUserTasks(poa); poa->Release(); } } poc->Release(); } return hr; }