Autor Beitrag
FriFra
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 557

Win XP Prof, Win XP Home,Win Server 2003,Win 98SE,Win 2000,Win NT4,Win 3.11,Suse Linux 7.3 Prof,Suse Linux 8.0 Prof
D2k5 Prof, D7 Prof, D5 Standard, D3 Prof, K3 Prof
BeitragVerfasst: Di 08.04.03 11:00 
Ich will wie folgt ein Icon laden:
ausblenden Quelltext
1:
icon.Handle := ExtractIcon(Handle, 'c:\windows\system32\shell32.dll', 10);					


Das Problem an der Sache ist allerdings, dass ich so immer nur das 32x32 (Truecolor) Icon bekomme, ich will aber das 16x16 (256 Farben) haben. Wie komme ich an dieses Icon?
wulfskin
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1349
Erhaltene Danke: 1

Win XP
D5 Pers (SSL), D2005 Pro, C, C#
BeitragVerfasst: Di 08.04.03 12:25 
Schau dir mal ExtractIconEx an, ich glaub, dass ist genau das richtige für dich!

_________________
Manche antworten um ihren Beitragszähler zu erhöhen, andere um zu Helfen.
FriFra Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 557

Win XP Prof, Win XP Home,Win Server 2003,Win 98SE,Win 2000,Win NT4,Win 3.11,Suse Linux 7.3 Prof,Suse Linux 8.0 Prof
D2k5 Prof, D7 Prof, D5 Standard, D3 Prof, K3 Prof
BeitragVerfasst: Di 08.04.03 15:52 
ExtractIconEx liefert mir jetzt endlich die 16x16 Icons. allerdings weiss ich noch nicht, wie ich an die 256 farbigen Icons komme...
Ich benötige die Icons für eine TreeView, dabei stört natürlich der Alphakanal (Transparenz unter XP), welcher im TreeView schwarz erscheint...
Wie bekomme ich das 256 farb Icon?
FriFra Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 557

Win XP Prof, Win XP Home,Win Server 2003,Win 98SE,Win 2000,Win NT4,Win 3.11,Suse Linux 7.3 Prof,Suse Linux 8.0 Prof
D2k5 Prof, D7 Prof, D5 Standard, D3 Prof, K3 Prof
BeitragVerfasst: Di 15.04.03 08:40 
Ich habs... Mein Problem mit den schwarzen alpha Kanälen kann man lösen, indem man der ImageList zur Laufzeit den kompletten Inhalt einer andeen Imagelist zuweist, welche derartige Icons bereits enthällt. Es ist also offensichtlich ein bug der Komponente...
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
procedure TForm1.FormCreate(Sender: TObject);
var
  SHFileInfo: TSHFileInfo;
  SysIcons: THandle;
begin
    // Handle der "ShellImageList" ermitteln
    SysIcons := SHGetFileInfo(PChar('C:\'), 0, SHFileInfo,
      SizeOf(SHFileInfo), SHGFI_SYSICONINDEX or SHGFI_SMALLICON or SHGFI_ICON);

    // Handle temporärer ImageList zuweisen
    ImageListTemp.Handle := SysIcons;

    // Assign ist wichtig, da bei der Zuweisung eines Handle
    // an z.B. mehrere ImageList immer alle geändert würden
    MyImageList.Assign(ImageListTemp); 
end;