1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
|
TV_INSERTSTRUCT tvinsert;
HTREEITEM hParent;
HTREEITEM hChild;
HTREEITEM hChild2;
WIN32_FIND_DATA IpFindFileData;
HANDLE hdlfff;
char str[1024];
LPCTSTR dir;
char *drive_list[] = {
"A:", "B:", "C:", "D:", "E:", "F:", "G:", "H:", "I:",
"J:", "K:", "L:", "M:", "N:", "O:", "P:", "Q:",
"R:", "S:", "T:", "U:", "V:", "W:", "Y:", "Z:"};
for(int loop = 0; loop < 25; loop++)
{
tvinsert.item.pszText = drive_list[loop];
if(GetDriveType(drive_list[loop]) == DRIVE_FIXED)
{
hParent = m_ChxLog.InsertItem(tvinsert.item.pszText,TVI_ROOT);
strcpy(str, tvinsert.item.pszText);
if (str[strlen(str)-1] != '\\')
{
strcat(str, "\\");
}
strcat(str, "*.*");
dir = str;
if(hdlfff = FindFirstFile(dir, &IpFindFileData))
{
do
{
if(strcmp(IpFindFileData.cFileName, ".") && strcmp(IpFindFileData.cFileName, ".."))
{
strcpy(str, tvinsert.item.pszText);
if (str[strlen(str)-1] != '\\')
{
strcat(str, "\\");
}
strcat(str, IpFindFileData.cFileName);
hChild = m_ChxLog.InsertItem(IpFindFileData.cFileName,hParent,TVI_LAST);
if (GetFileAttributes(str) == 16)
{
hChild2 = m_ChxLog.InsertItem(IpFindFileData.cFileName,hChild,TVI_LAST);
}
}
}
while(FindNextFile(hdlfff, &IpFindFileData));
}
FindClose(hdlfff);
}
} |
Partager