procedure TSkinDriveList.ListDrive(hList: hWnd);
var
FileInfo: SHFILEINFO;
AllDriveStrings: LongWord;
Drives:
array [0 .. 128]
of Widechar;
pDrive: PWideChar;
IconCount: Integer;
begin
IconCount := 1;
ZeroMemory(@FileInfo, sizeof(SHFILEINFO));
DriveList := TStringList.Create;
AllDriveStrings := GetLogicalDriveStrings(SizeOf(Drives), Drives);
if AllDriveStrings = 0
then
exit;
if AllDriveStrings > SizeOf(Drives)
then
raise Exception.Create(SysErrorMessage(ERROR_OUTOFMEMORY));
pDrive := Drives;
while pDrive^ <> #0
do
begin
SHGetFileInfo(pDrive, FILE_ATTRIBUTE_NORMAL, FileInfo, SizeOf(FileInfo),
SHGFI_DISPLAYNAME
Or SHGFI_SYSICONINDEX
or SHGFI_SMALLICON
or SHGFI_ICON);
if GetDriveType(pDrive) = DRIVE_NO_ROOT_DIR
or DRIVE_FIXED
then
begin
DriveList.Add(pDrive);
ListAdd(hList, FileInfo.szDisplayName);
SetLength(IconHandle, IconCount + 1);
IconHandle[IconCount] := FileInfo.HIcon;
inc(IconCount);
inc(pDrive, 4);
end
else
inc(pDrive, 4);
end;
end;