本文整理汇总了C++中IShellFolder::CompareIDs方法的典型用法代码示例。如果您正苦于以下问题:C++ IShellFolder::CompareIDs方法的具体用法?C++ IShellFolder::CompareIDs怎么用?C++ IShellFolder::CompareIDs使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IShellFolder
的用法示例。
在下文中一共展示了IShellFolder::CompareIDs方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
/*
* Class: sun_awt_shell_Win32ShellFolder2
* Method: compareIDs
* Signature: (JJJ)I
*/
JNIEXPORT jint JNICALL Java_sun_awt_shell_Win32ShellFolder2_compareIDs
(JNIEnv* env, jclass cls, jlong jpParentIShellFolder, jlong pIDL1, jlong pIDL2)
{
IShellFolder* pParentIShellFolder = (IShellFolder*)jpParentIShellFolder;
if (pParentIShellFolder == NULL) {
return 0;
}
return pParentIShellFolder->CompareIDs(0, (LPCITEMIDLIST) pIDL1, (LPCITEMIDLIST) pIDL2);
}
示例2:
// NOTE: Sorting added by Anatoly Ivasyuk.
static int CALLBACK _SortFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
{
IShellFolder* piSF = reinterpret_cast<IShellFolder*>(lParamSort);
PSHELLITEMINFO pItem1 = reinterpret_cast<PSHELLITEMINFO>(lParam1);
PSHELLITEMINFO pItem2 = reinterpret_cast<PSHELLITEMINFO>(lParam2);
HRESULT Hr = piSF->CompareIDs(0, pItem1->pidlNode, pItem2->pidlNode);
if( SUCCEEDED(Hr) ) return (SHORT) (Hr & SHCIDS_COLUMNMASK);
return 0;
}
示例3: PidlListSort
int CALLBACK PidlListSort(void* item1, void* item2, LPARAM lParam)
{
IShellFolder * psf = (IShellFolder*) lParam;
PCUIDLIST_RELATIVE pidl1 = (PCUIDLIST_RELATIVE) item1;
PCUIDLIST_RELATIVE pidl2 = (PCUIDLIST_RELATIVE) item2;
HRESULT hr = psf->CompareIDs(0, pidl1, pidl2);
if (FAILED(hr))
{
// No way to cancel, so sort to equal.
return 0;
}
return (int)(short)LOWORD(hr);
}
示例4: return
/*
* Class: sun_awt_shell_Win32ShellFolder2
* Method: compareIDsByColumn
* Signature: (JJJI)I
*/
JNIEXPORT jint JNICALL
Java_sun_awt_shell_Win32ShellFolder2_compareIDsByColumn
(JNIEnv* env, jclass cls, jlong jpParentIShellFolder,
jlong pIDL1, jlong pIDL2, jint columnIdx)
{
IShellFolder* pParentIShellFolder = (IShellFolder*)jpParentIShellFolder;
if (pParentIShellFolder == NULL) {
return 0;
}
HRESULT hr = pParentIShellFolder->CompareIDs(
(UINT) columnIdx,
(LPCITEMIDLIST) pIDL1,
(LPCITEMIDLIST) pIDL2);
if (SUCCEEDED (hr)) {
return (jint) (short) HRESULT_CODE(hr);
}
return 0;
}
示例5: FindPaths
bool CDeskBand::FindPaths()
{
m_currentDirectory.clear();
m_selectedItems.clear();
m_bFilesSelected = false;
m_bFolderSelected = false;
if (m_pSite == NULL)
return false;
IServiceProvider * pServiceProvider;
if (SUCCEEDED(m_pSite->QueryInterface(IID_IServiceProvider, (LPVOID*)&pServiceProvider)))
{
IShellBrowser * pShellBrowser;
if (SUCCEEDED(pServiceProvider->QueryService(SID_SShellBrowser, IID_IShellBrowser, (LPVOID*)&pShellBrowser)))
{
IShellView * pShellView;
if (SUCCEEDED(pShellBrowser->QueryActiveShellView(&pShellView)))
{
IFolderView * pFolderView;
if (SUCCEEDED(pShellView->QueryInterface(IID_IFolderView, (LPVOID*)&pFolderView)))
{
// hooray! we got the IFolderView interface!
// that means the explorer is active and well :)
// but we also need the IShellFolder interface because
// we need its GetCurFolder() method
IPersistFolder2 * pPersistFolder;
if (SUCCEEDED(pFolderView->GetFolder(IID_IPersistFolder2, (LPVOID*)&pPersistFolder)))
{
LPITEMIDLIST folderpidl;
if (SUCCEEDED(pPersistFolder->GetCurFolder(&folderpidl)))
{
// we have the current folder
TCHAR buf[MAX_PATH] = {0};
// find the path of the folder
if (SHGetPathFromIDList(folderpidl, buf))
{
m_currentDirectory = buf;
}
// if m_currentDirectory is empty here, that means
// the current directory is a virtual path
IShellFolder * pShellFolder;
if (SUCCEEDED(pPersistFolder->QueryInterface(IID_IShellFolder, (LPVOID*)&pShellFolder)))
{
// if there was a new folder created but not found to set into editing mode,
// we try here to do that
if (!m_newfolderPidls.empty())
{
int nCount2 = 0;
IShellFolder * pShellFolder;
if (SUCCEEDED(pPersistFolder->QueryInterface(IID_IShellFolder, (LPVOID*)&pShellFolder)))
{
if (SUCCEEDED(pFolderView->ItemCount(SVGIO_ALLVIEW, &nCount2)))
{
for (int i=0; i<nCount2; ++i)
{
LPITEMIDLIST pidl;
pFolderView->Item(i, &pidl);
bool bFound = false;
for (std::vector<LPITEMIDLIST>::iterator it = m_newfolderPidls.begin(); it != m_newfolderPidls.end(); ++it)
{
HRESULT hr = pShellFolder->CompareIDs(0, pidl, *it);
if (HRESULT_CODE(hr) == 0)
{
// this item was there before, so it's not the new folder
CoTaskMemFree(*it);
m_newfolderPidls.erase(it);
bFound = true;
break;
}
}
if (!bFound)
{
pShellView->SelectItem(pidl, SVSI_EDIT);
}
CoTaskMemFree(pidl);
}
}
if ((nCount2)||(m_newfolderTimeoutCounter-- <= 0))
{
m_newfolderTimeoutCounter = 0;
for (std::vector<LPITEMIDLIST>::iterator it = m_newfolderPidls.begin(); it != m_newfolderPidls.end(); ++it)
{
CoTaskMemFree(*it);
}
m_newfolderPidls.clear();
}
pShellFolder->Release();
}
}
// find all selected items
IEnumIDList * pEnum;
if (SUCCEEDED(pFolderView->Items(SVGIO_SELECTION, IID_IEnumIDList, (LPVOID*)&pEnum)))
{
LPITEMIDLIST pidl;
WCHAR buf[MAX_PATH] = {0};
ULONG fetched = 0;
ULONG attribs = 0;
//.........这里部分代码省略.........
示例6: Filter
//.........这里部分代码省略.........
{
// force the filter to lowercase
TCHAR * pString = filter;
while (*pString)
{
*pString = _totlower(*pString);
pString++;
}
}
int nCount = 0;
if (SUCCEEDED(pFolderView->ItemCount(SVGIO_ALLVIEW, &nCount)))
{
pShellFolderView->SetRedraw(FALSE);
HWND listView = GetListView32(pShellView);
LRESULT viewType = 0;
if (listView)
{
// inserting items in the list view if the list view is set to
// e.g., LV_VIEW_LIST is painfully slow. So save the current view
// and set it to LV_VIEW_DETAILS (which is much faster for inserting)
// and restore the view after we're done.
viewType = SendMessage(listView, LVM_GETVIEW, 0, 0);
SendMessage(listView, LVM_SETVIEW, LV_VIEW_DETAILS, 0);
}
std::vector<LPITEMIDLIST> noShows;
for (int i=0; i<nCount; ++i)
{
LPITEMIDLIST pidl;
if (SUCCEEDED(pFolderView->Item(i, &pidl)))
{
if (CheckDisplayName(pShellFolder, pidl, filter, bUseRegex))
{
// remove now shown items which are in the no-show list
// this is necessary since we don't get a notification
// if the shell refreshes its view
for (std::vector<LPITEMIDLIST>::iterator it = m_noShows.begin(); it != m_noShows.end(); ++it )
{
if (HRESULT_CODE(pShellFolder->CompareIDs(SHCIDS_CANONICALONLY, *it, pidl))==0)
{
m_noShows.erase(it);
break;
}
}
CoTaskMemFree(pidl);
}
else
{
UINT puItem = 0;
if (pShellFolderView->RemoveObject(pidl, &puItem) == S_OK)
{
i--;
nCount--;
noShows.push_back(pidl);
}
}
}
}
// now add all those items again which were removed by a previous filter string
// but don't match this new one
//pShellFolderView->SetObjectCount(5000, SFVSOC_INVALIDATE_ALL|SFVSOC_NOSCROLL);
for (size_t i=0; i<m_noShows.size(); ++i)
{
LPITEMIDLIST pidlNoShow = m_noShows[i];
if (CheckDisplayName(pShellFolder, pidlNoShow, filter, bUseRegex))
{
m_noShows.erase(m_noShows.begin() + i);
i--;
UINT puItem = (UINT)i;
pShellFolderView->AddObject(pidlNoShow, &puItem);
CoTaskMemFree(pidlNoShow);
}
}
for (size_t i=0; i<noShows.size(); ++i)
{
m_noShows.push_back(noShows[i]);
}
if (listView)
{
SendMessage(listView, LVM_SETVIEW, viewType, 0);
}
pShellFolderView->SetRedraw(TRUE);
}
pShellFolder->Release();
}
pPersistFolder->Release();
}
pShellFolderView->Release();
}
pFolderView->Release();
}
pShellView->Release();
}
pShellBrowser->Release();
}
pServiceProvider->Release();
}
return bReturn;
}