MCPcopy Create free account
hub / github.com/derceg/explorerplusplus / OnTimer

Method OnTimer

Explorer++/Explorer++/SearchDialog.cpp:915–974  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

913}
914
915INT_PTR SearchDialog::OnTimer(int iTimerID)
916{
917 if (iTimerID != SEARCH_PROCESSITEMS_TIMER_ID)
918 {
919 return 1;
920 }
921
922 HWND hListView = GetDlgItem(m_hDlg, IDC_LISTVIEW_SEARCHRESULTS);
923 int nListViewItems = ListView_GetItemCount(hListView);
924
925 int nItems =
926 min(static_cast<int>(m_AwaitingSearchItems.size()), SEARCH_MAX_ITEMS_BATCH_PROCESS);
927 int i = 0;
928
929 auto itr = m_AwaitingSearchItems.begin();
930
931 while (i < nItems)
932 {
933 TCHAR szFullFileName[MAX_PATH];
934 TCHAR szDirectory[MAX_PATH];
935 TCHAR szFileName[MAX_PATH];
936 LVITEM lvItem;
937 SHFILEINFO shfi;
938 int iIndex;
939
940 PIDLIST_ABSOLUTE pidl = *itr;
941
942 GetDisplayName(pidl, szDirectory, SIZEOF_ARRAY(szDirectory), SHGDN_FORPARSING);
943 PathRemoveFileSpec(szDirectory);
944
945 GetDisplayName(pidl, szFullFileName, SIZEOF_ARRAY(szFullFileName), SHGDN_FORPARSING);
946 GetDisplayName(
947 pidl, szFileName, SIZEOF_ARRAY(szFileName), SHGDN_INFOLDER | SHGDN_FORPARSING);
948
949 SHGetFileInfo((LPCWSTR) pidl, 0, &shfi, sizeof(shfi), SHGFI_PIDL | SHGFI_SYSICONINDEX);
950
951 m_SearchItemsMapInternal.insert(
952 std::unordered_map<int, std::wstring>::value_type(m_iInternalIndex, szFullFileName));
953
954 lvItem.mask = LVIF_IMAGE | LVIF_TEXT | LVIF_PARAM;
955 lvItem.pszText = szFileName;
956 lvItem.iItem = nListViewItems + i;
957 lvItem.iSubItem = 0;
958 lvItem.iImage = shfi.iIcon;
959 lvItem.lParam = m_iInternalIndex++;
960 iIndex = ListView_InsertItem(hListView, &lvItem);
961
962 ListView_SetItemText(hListView, iIndex, 1, szDirectory);
963
964 CoTaskMemFree(pidl);
965
966 itr = m_AwaitingSearchItems.erase(itr);
967
968 i++;
969 }
970
971 m_bSetSearchTimer = TRUE;
972

Callers

nothing calls this directly

Calls 5

GetDisplayNameFunction · 0.85
sizeMethod · 0.45
beginMethod · 0.45
insertMethod · 0.45
eraseMethod · 0.45

Tested by

no test coverage detected