Thema: Delphi Systemicons und Listview

Einzelnen Beitrag anzeigen

MathiasSimmack
(Gast)

n/a Beiträge
 
#28

Re: Systemicons und Listview

  Alt 4. Jun 2004, 07:40
Du brauchst zwei Units:
Delphi-Quellcode:
uses
  ShlObj, // für PItemIdList
  ActiveX; // für IMalloc
Und Ja: mit dem Index geht es auch. Basierend auf Christians Code:
Delphi-Quellcode:
li := lv.Items.Add;
li.Caption := 'Arbeitsplatz';

if(SHGetSpecialFolderLocation(0,CSIDL_DRIVES,pidlDSK) =
  S_OK) then
try
  SHGetFileInfo(pchar(pidlDSK),0,fi,sizeof(fi),
    SHGFI_PIDL or SHGFI_ICON or SHGFI_SYSICONINDEX);
  li.ImageIndex := fi.iIcon;
finally
  SHGetMalloc(imWork);
end;
wobei ich aber CSIDL_DESKTOP durch CSIDL_DRIVES ersetzt habe, denn im PSDK steht:
Zitat:
CSIDL_DRIVES
The virtual folder representing My Computer, [...]
Das andere wäre dieses Symbol, dass du auch in der Schnellstartleiste siehst, bzw. als Root im Windows-Explorer. Aber das Symbol des Arbeitsplatzes (das auf dem Desktop) ist bei mir ein anderes.
  Mit Zitat antworten Zitat