Click here to Skip to main content
11,502,812 members (50,116 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: C++ MFC

I want to list files and directorys with the image icons. I can only get files. Or I can get only directorys. I know its something with the flags but can not figure it out. I checked documentary with the command and used all the flags but still does not work

If i just use FILE_ATTRIBUTE_DIRECTORY, than everything is a folder..even files like *.sys

If i just use FILE_ATTRIBUTE_ARCHIVE, then folders don't get listed.....

i looked in Winnt.h..nothing works
Posted 12-Jul-13 21:03pm
Edited 12-Jul-13 21:18pm

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

When using the SHGFI_USEFILEATTRIBUTES flag, the dwFileAttributes parameter specifies if the passed file name is a directory or a file. So you must pass the attribute of the specific file and not a combination of attributes.

I assume that you are using CFileFind or FindFirstFile() / FindNextFile() to get the file list. Then use the attributes provided by these functions or just FILE_ATTRIBUTE_DIRECTORY for directories and FILE_ATTRIBUTE_NORMAL for files.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Advertise | Privacy | Mobile
Web03 | 2.8.150520.1 | Last Updated 13 Jul 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100