was ist neu ¦  programmier tips ¦  indy artikel ¦  intraweb artikel ¦  informationen ¦  links ¦  interviews
 sonstiges ¦  tutorials ¦  Add&Win Gewinnspiel

Tips (1541)

Dateien (137)
Datenbanken (90)
Drucken (35)
Grafik (114)
IDE (21)
Indy (5)
Internet / LAN (130)
IntraWeb (0)
Mathematik (76)
Multimedia (45)
Oberfläche (107)
Objekte/
ActiveX (51)

OpenTools API (3)
Sonstiges (126)
Strings (83)
System (266)
VCL (242)

Tips sortiert nach
Komponente


Tip suchen

Tip hinzufügen

Add&Win Gewinnspiel

Werbung

33 Visitors Online


 
...das Icon einer CD-ROM laden?
Autor: Horst Kniebusch
Homepage: http://www.the-admin.de.vu
[ Tip ausdrucken ]  

Tip Bewertung (7):  
     


function GetCDIcon(Drive: Char): TIcon;
var
  
ico: TIcon;
  ini: TIniFile;
  s, p: string;
  i, j: Integer;
begin
  
//Abbrechen wenn "AutoRun.Inf" nicht existiert.
  //Abort if "AutoRun.inf" doesn't exists.
  
if FileExists(Drive + ':\autorun.inf') = False then Exit;

  //"AutoRun.inf" öffnen
  //Opens the "AutoRun.inf"
  
ini := TIniFile.Create(Drive + ':\autorun.inf');
  ico := TIcon.Create;

  try
    
//Dateinamen lesen
    //Read the filename
    
s := ini.ReadString('Autorun', 'ICON', '');

    //Abbrechen, wenn kein Icon festgelegt wurde
    //Abort if there is no icon specified
    
if s = '' then Exit;

    //Icon von Datei laden
    //load the icon from a file
    
if FileExists(s) then ico.LoadFromFile(s);
    if FileExists(Drive + ':\' + s) then ico.LoadFromFile(Drive + ':\' + s);

    //Icon aus einer Resource laden
    //Load the icon from a 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);
    end;

    Result := ico;
  finally
    
ini.Free;
  end;
end;

 

Bewerten Sie diesen Tipp:

dürftig
ausgezeichnet


Copyright © by SwissDelphiCenter.ch
All trademarks are the sole property of their respective owners