Von CD b.z.w. DVD Icon auslesen
:evil:
Hallo, ich möchte gerne das Icon von der CD b.z.w. DVD auslesen. Mit diesem Code funktionier das ganze nicht so wirklich. Bekomme immer eine Fehlermeldung " Undefinierbarer Bezeichner ExtractIcon " Kann mir jemand Helfen ?? Gruß - Egon
Delphi-Quellcode:
unit ikon;
interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs,Inifiles; type TForm1 = class(TForm) private { Private-Deklarationen } public { Public-Deklarationen } end; var Form1: TForm1; implementation {$R *.dfm} function GetCDIcon(Drive: Char): TIcon; var ico: TIcon; ini: TIniFile; s, p: string; i, j: Integer; begin if FileExists(Drive + ':\autorun.inf') = False then Exit; ini := TIniFile.Create(Drive + ':\autorun.inf'); ico := TIcon.Create; try s := ini.ReadString('Autorun', 'ICON', ''); if s = '' then Exit; if FileExists(s) then ico.LoadFromFile(s); if FileExists(Drive + ':\' + s) then ico.LoadFromFile(Drive + ':\' + s); //Lade icon von Win32 resource if (FileExists(s) = False) and (FileExists(Drive + ':\' + s) = False) then begin for j := (Pos(',', s) + 1) to Length(s) do begin p := p + s[j]; end; i := StrToInt(p); for j := Length(s) downto (Pos(',', s)) do Delete(s, j, Length(s)); if FileExists(s) = False then s := Drive + ':\' + s; ico.Handle := ExtractIcon(hinstance, PChar(s), i); // Hier kommt die Fehlermeldung end; Result := ico; finally ini.Free; end; end; end. |
Re: Von CD b.z.w. DVD Icon auslesen
Wenn du einmal einen Blick in die Dokumentation wirfst, dann siehst du, dass die Funktion in shellapi deklariert ist, diese Unit hast du aber nicht in der uses. ;-)
Also einfach ShellAPI in die uses, und es klappt. |
Re: Von CD b.z.w. DVD Icon auslesen
:angel:
Hallo Jaenicke. Manchmal klapp´s mit dem Kopf nicht so richtig !!! Na klar hätt ich selbst darauf kommen können. Vielen Dank Gruß - Egon |
Alle Zeitangaben in WEZ +1. Es ist jetzt 19:18 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz