bool ShortCutManager::InsertItem(CDialog *pParent, TCHAR *path) { std::vector<ShortCutItem *>::iterator itor = m_shortcutList.begin(); while (itor != m_shortcutList.end()) { ShortCutItem *p = *itor; if (0 == _tcscmp(p->GetPath(), path)) { // already exist return false; } itor++; } HICON hIcon = GetHighResolutionIcon(path); MYICON_INFO info = MyGetIconInfo(hIcon); ShortCutItem *p = new ShortCutItem(this, pParent, path, hIcon, false, -1); RECT rc; p->Create(pParent, CRect(10, 10, 210, 30), _T("Nice Work")); std::vector<ShortCutItem *>::iterator it = m_shortcutList.end(); m_shortcutList.insert(it, p); }
HRESULT PreviewGenerator::BuildPreview(CString fPath, CString fExt) { filePath = fPath; fileExt = fExt; HRESULT hr = E_FAIL; for (int i = 0; i < clsidList.size(); i++) { CLSID cls = clsidList[i]; //CLSIDFromString((LPWSTR)(LPCTSTR)clsidList[i], &cls); hr = ShowPreviewWithPreviewHandler(filePath, cls); if (hr == S_OK) return hr; hr = ShowPreviewWithThumbnailProvider(filePath, cls); if (hr == S_OK) return hr; } if (hr != S_OK) { if (iPHandler) { iPHandler->Unload(); SAFERELEASE(iPHandler); } hr = ShowPreviewWithShellItemImageFactory(filePath); if (hr != S_OK) hr = GetHighResolutionIcon(filePath); } return hr; }