int CALLBACK CShellBrowser::SortByType(int InternalIndex1,int InternalIndex2) const { if(m_bVirtualFolder) { TCHAR FullFileName1[MAX_PATH]; LPITEMIDLIST pidlComplete1 = ILCombine(m_pidlDirectory,m_pExtraItemInfo[InternalIndex1].pridl); GetDisplayName(pidlComplete1,FullFileName1,SHGDN_FORPARSING); CoTaskMemFree(pidlComplete1); TCHAR FullFileName2[MAX_PATH]; LPITEMIDLIST pidlComplete2 = ILCombine(m_pidlDirectory,m_pExtraItemInfo[InternalIndex2].pridl); GetDisplayName(pidlComplete2,FullFileName2,SHGDN_FORPARSING); CoTaskMemFree(pidlComplete2); BOOL IsRoot1 = PathIsRoot(FullFileName1); BOOL IsRoot2 = PathIsRoot(FullFileName2); if(IsRoot1 && !IsRoot2) { return -1; } else if(!IsRoot1 && IsRoot2) { return 1; } } std::wstring Type1 = GetTypeColumnText(InternalIndex1); std::wstring Type2 = GetTypeColumnText(InternalIndex2); return StrCmpLogicalW(Type1.c_str(),Type2.c_str()); }
int CALLBACK CShellBrowser::SortByType(const BasicItemInfo_t &itemInfo1, const BasicItemInfo_t &itemInfo2) const { if(m_bVirtualFolder) { TCHAR FullFileName1[MAX_PATH]; GetDisplayName(itemInfo1.pidlComplete.get(),FullFileName1,SIZEOF_ARRAY(FullFileName1),SHGDN_FORPARSING); TCHAR FullFileName2[MAX_PATH]; GetDisplayName(itemInfo2.pidlComplete.get(),FullFileName2,SIZEOF_ARRAY(FullFileName2),SHGDN_FORPARSING); BOOL IsRoot1 = PathIsRoot(FullFileName1); BOOL IsRoot2 = PathIsRoot(FullFileName2); if(IsRoot1 && !IsRoot2) { return -1; } else if(!IsRoot1 && IsRoot2) { return 1; } } std::wstring Type1 = GetTypeColumnText(itemInfo1); std::wstring Type2 = GetTypeColumnText(itemInfo2); return StrCmpLogicalW(Type1.c_str(),Type2.c_str()); }