Click here to Skip to main content
15,893,663 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralWM_CLOSE Priority Pin
Anonymous18-Dec-03 18:24
Anonymous18-Dec-03 18:24 
GeneralRe: WM_CLOSE Priority Pin
John R. Shaw18-Dec-03 18:58
John R. Shaw18-Dec-03 18:58 
GeneralRe: WM_CLOSE Priority Pin
Anonymous18-Dec-03 19:14
Anonymous18-Dec-03 19:14 
GeneralRe: WM_CLOSE Priority Pin
Monty218-Dec-03 19:42
Monty218-Dec-03 19:42 
GeneralRe: WM_CLOSE Priority Pin
John R. Shaw18-Dec-03 21:36
John R. Shaw18-Dec-03 21:36 
Generalde-selecting items in cList Control Pin
azusakt18-Dec-03 17:32
azusakt18-Dec-03 17:32 
GeneralRe: de-selecting items in cList Control Pin
John R. Shaw18-Dec-03 17:47
John R. Shaw18-Dec-03 17:47 
GeneralDirectory Contents Question Pin
Roger Wright18-Dec-03 16:17
professionalRoger Wright18-Dec-03 16:17 
I've spent the past two days playing with sample code that is supposed to, given a main directory, allow me to select one or more subdirectories and collect stats on them including the number of files, and the total size of each subdirectory. The technique used starts with

hFind = FindFirstFile(strFind, &dataFind);

where strFind is a wildcard search string on the main directory, and dataFind is a WIN32_FIND_DATA structure. Directories are identified by

if(dataFind.dwFileAttributes == FILE_ATTRIBUTE_DIRECTORY)

in a loop that traverses the entire directory. I found that this correctly identified only a few subdirectories, but couldn't figure out why. In a later section, files within a subdirectory are found using the same technique but using

if(dataFind.dwFileAttributes == FILE_ATTRIBUTE_ARCHIVE)

as the search criterion. This, too, failed to find all the files in the subdirectory. After many hours of research and experimenting I deduced that this is a stupid way to do this task, though it was a great way to demonstrate how to use the various controls in a dialog box. The reason, it appears to me, is that the field dwFileAttributes is an OR of one or more of many attributes, and rarely just a single one, so any single value comparison on a multiple-attribute entity will fail.

So my question is, what is a proper method for reliably testing whether a directory entity is a file or a subdirectory?


"Another day done - All targets met; all systems fully operational; all customers satisfied; all staff keen and well motivated; all pigs fed and ready to fly" - Jennie A.

GeneralRe: Directory Contents Question Pin
Rob Manderson18-Dec-03 16:55
protectorRob Manderson18-Dec-03 16:55 
GeneralRe: Directory Contents Question Pin
Roger Wright18-Dec-03 20:38
professionalRoger Wright18-Dec-03 20:38 
GeneralRe: Directory Contents Question Pin
Rob Manderson18-Dec-03 22:22
protectorRob Manderson18-Dec-03 22:22 
GeneralRe: Directory Contents Question Pin
Roger Wright19-Dec-03 5:23
professionalRoger Wright19-Dec-03 5:23 
GeneralRe: Directory Contents Question Pin
John R. Shaw18-Dec-03 17:09
John R. Shaw18-Dec-03 17:09 
GeneralRe: Directory Contents Question Pin
Roger Wright18-Dec-03 20:45
professionalRoger Wright18-Dec-03 20:45 
GeneralRe: Directory Contents Question Pin
John R. Shaw18-Dec-03 22:12
John R. Shaw18-Dec-03 22:12 
GeneralRe: Directory Contents Question Pin
Rob Manderson18-Dec-03 22:55
protectorRob Manderson18-Dec-03 22:55 
GeneralRe: Directory Contents Question Pin
Roger Wright19-Dec-03 5:16
professionalRoger Wright19-Dec-03 5:16 
QuestionGDI Objects LEAK due to manifest file codes? Pin
Yu Zhiquan18-Dec-03 16:03
Yu Zhiquan18-Dec-03 16:03 
AnswerRe: GDI Objects LEAK due to manifest file codes? Pin
John R. Shaw18-Dec-03 16:50
John R. Shaw18-Dec-03 16:50 
Generaldumbest question in the world Pin
rajdawg18-Dec-03 15:03
rajdawg18-Dec-03 15:03 
Generaloops....lets try this with code tags Pin
rajdawg18-Dec-03 15:05
rajdawg18-Dec-03 15:05 
GeneralRe: oops....lets try this with code tags Pin
rajdawg18-Dec-03 15:06
rajdawg18-Dec-03 15:06 
GeneralRe: oops....lets try this with code tags Pin
Christian Graus18-Dec-03 15:28
protectorChristian Graus18-Dec-03 15:28 
GeneralRe: dumbest question in the world Pin
Michael Dunn18-Dec-03 18:06
sitebuilderMichael Dunn18-Dec-03 18:06 
GeneralApplication Error Pin
help_me_pleeze18-Dec-03 15:01
help_me_pleeze18-Dec-03 15:01 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.