Thema: Delphi Icon aus DLL laden

Einzelnen Beitrag anzeigen

Benutzerbild von HomerGER
HomerGER

Registriert seit: 8. Jun 2003
390 Beiträge
 
Delphi 7 Professional
 
#26

Re: Icon aus DLL laden

  Alt 9. Nov 2003, 21:24
ne las mal deine kurzform funktioniert wunderbar
genau so wie es haben wollt
ich glaube es gib mit TICON ein generelles Problem
auch aus einer resource oder dll zu laden

hier meine function um es aus dll usw zu extrahieren

Code:
//******************************************************************************
// HauptFunction
//Icon aus exe dll usw ins Image ausgeben
Procedure Icon_Extract_GU(input_s : String; kompo_s : String);
var
bild_path_s : String;
icon : TIcon;
path_s : String;
pos_i : Integer;
index_i : Integer;
begin

    try
        //Platzhalter ersetzen //für %Root% und so
        bild_path_s := Platzhalter_Ersetzen_GU(input_s);

        //Alles rücksetzen
        icon := TIcon.Create;
        path_s := '';

        //Kein Komma verhanden
        if pos(',', bild_path_s) = 0 then
         begin
            bild_path_s := bild_path_s + ',0';
            pos_i := pos(',', bild_path_s);
        end
        //Komma vorhanden
        else
        begin
            pos_i := pos(',', bild_path_s);
        end;

        //Path filtern
        path_s := copy(bild_path_s, 1, pos_i - 1);

        //Index filtern
        index_i := StrToInt(copy(bild_path_s, pos_i + 1, Length(bild_path_s)));

        icon.Handle := ExtractIcon(hInstance,PChar(path_s),index_i);

        (Haupt_Form.FindComponent(kompo_s) as TImage).Picture.Icon := icon;
    finally
        icon.Free;
    end;
end;
  Mit Zitat antworten Zitat