procedure Createimages; // Sets the system's imagelists for the listview
var
SysIL: uint;
SFI: TSHFileInfo;
begin
{ Credits to Brad Stowers bstowers@pobox.com or 72733,3374 on CompuServe.}
{ I ripped most of the shell-stuff of this app from his components. But because I'm quite
worry about the C-design of shellapi and shlobj, i use only the shell-routines i really
need for this program. Maybe a few other Delphi-programmers have also trouble with ^TIID...}
{ Create the image list. We don't really "create" one. We fool SHGetFileInfo into
giving us the system's image list and use it's handle. You'd think it would be
easier to get the handle of the system image list.... }
Larges := TImageList.Create(form1);
SysIL := SHGetFileInfo('', 0, SFI, SizeOf(SFI), SHGFI_SYSICONINDEX or SHGFI_LARGEICON);
if SysIL <> 0 then begin
Larges.Handle := SysIL;
Larges.ShareImages := TRUE; // DON'T FREE THE SYSTEM IMAGE LIST!!!!! BAD IDEA (tm)!
end;
Smalls := TImageList.Create(form1);
SysIL := SHGetFileInfo('', 0, SFI, SizeOf(SFI), SHGFI_SYSICONINDEX or SHGFI_SMALLICON);
if SysIL <> 0 then begin
Smalls.Handle := SysIL;
Smalls.ShareImages := TRUE; // DON'T FREE THE SYSTEM IMAGE LIST!!!!! BAD IDEA (tm)!
end;
IDI_APPLICATION Default application icon.
IDI_ASTERISK Same as IDI_INFORMATION.
IDI_ERROR Hand-shaped icon.
IDI_EXCLAMATION Same as IDI_WARNING.
IDI_HAND Same as IDI_ERROR.
IDI_INFORMATION Asterisk icon.
IDI_QUESTION Question mark icon.
IDI_WARNING Exclamation point icon.
IDI_WINLOGO Windows logo icon.