MCPcopy Create free account
hub / github.com/ProgerXP/Notepad2e / DirList_Fill

Function DirList_Fill

src/Dlapi.c:207–396  ·  view source on GitHub ↗

============================================================================= DirList_Fill() Snapshots a directory and displays the items in the listview control

Source from the content-addressed store, hash-verified

205// Snapshots a directory and displays the items in the listview control
206//
207int DirList_Fill(HWND hwnd,LPCWSTR lpszDir,DWORD grfFlags,LPCWSTR lpszFileSpec,
208 BOOL bExcludeFilter,BOOL bNoFadeHidden,
209 int iSortFlags,BOOL fSortRev)
210{
211
212 WCHAR wszDir[MAX_PATH];
213
214 LPSHELLFOLDER lpsfDesktop = NULL;
215 LPSHELLFOLDER lpsf = NULL;
216
217 LPITEMIDLIST pidl = NULL;
218 LPITEMIDLIST pidlEntry = NULL;
219
220 LPENUMIDLIST lpe = NULL;
221
222 LV_ITEM lvi;
223 LPLV_ITEMDATA lplvid;
224
225 ULONG chParsed = 0;
226 ULONG dwAttributes = 0;
227
228 DL_FILTER dlf;
229 SHFILEINFO shfi;
230
231 LPDLDATA lpdl = (LPVOID)GetProp(hwnd,pDirListProp);
232
233 // Initialize default icons
234 SHGetFileInfo(L"Icon",FILE_ATTRIBUTE_DIRECTORY,&shfi,sizeof(SHFILEINFO),
235 SHGFI_USEFILEATTRIBUTES | SHGFI_SMALLICON | SHGFI_SYSICONINDEX);
236 lpdl->iDefIconFolder = shfi.iIcon;
237
238 SHGetFileInfo(L"Icon",FILE_ATTRIBUTE_NORMAL,&shfi,sizeof(SHFILEINFO),
239 SHGFI_USEFILEATTRIBUTES | SHGFI_SMALLICON | SHGFI_SYSICONINDEX);
240 lpdl->iDefIconFile = shfi.iIcon;
241
242 // First of all terminate running icon thread
243 DirList_TerminateIconThread(hwnd);
244
245 // A Directory is strongly required
246 if (!lpszDir || !*lpszDir)
247 return(-1);
248
249 lstrcpy(lpdl->szPath,lpszDir);
250
251 // Init ListView
252 SendMessage(hwnd,WM_SETREDRAW,0,0);
253 ListView_DeleteAllItems(hwnd);
254
255 // Init Filter
256 DirList_CreateFilter(&dlf,lpszFileSpec,bExcludeFilter);
257
258 // Init lvi
259 lvi.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_PARAM;
260 lvi.iItem = 0;
261 lvi.iSubItem = 0;
262 lvi.pszText = LPSTR_TEXTCALLBACK;
263 lvi.cchTextMax = MAX_PATH;
264 lvi.iImage = I_IMAGECALLBACK;

Callers 2

OpenWithDlgProcFunction · 0.85
FavoritesDlgProcFunction · 0.85

Calls 8

DirList_CreateFilterFunction · 0.85
DirList_MatchFilterFunction · 0.85
IL_GetSizeFunction · 0.85
DirList_SortFunction · 0.85
NextMethod · 0.80
AddRefMethod · 0.45
ReleaseMethod · 0.45

Tested by

no test coverage detected