萬盛學電腦網

 萬盛學電腦網 >> 網絡編程 >> 編程語言綜合 >> delphi編寫提取exe文件的ICO圖標

delphi編寫提取exe文件的ICO圖標

  會寫自己的EXE程序,但沒一個好看的EXE圖標,是不是很遺憾啊?很多軟件都有很好看的圖標,我們為什麼不提取出來呢?下面教你怎麼用delphi編程提取EXE文件的圖標,並保存為ICO格式的.

  代碼如下:

procedureTForm1.getIcon;

var

Count:Integer;

FileName:String;

i:integer;

begin

if(FileName<>Edit1.Text)then

begin

FileName:=Edit1.Text;

I:=0;

Count:=ExtractIcon(Application.Handle,PChar(FileName),

$FFFFFFFF);

end

else

Inc(I);

if(I

Image1.Picture.Icon.Handle:=

ExtractIcon(Application.Handle,PChar(FileName),I)

else

ShowMessage(’沒有找到!’);

end;

procedureTForm1.Button1Click(Sender:TObject);

begin

getIcon;

end;

procedureTForm1.Button2Click(Sender:TObject);

begin

opendialog1.Execute;

edit1.Text:=opendialog1.FileName;

end;

procedureTForm1.Button3Click(Sender:TObject);

begin

savedialog1.Execute;

image1.Picture.SaveToFile(savedialog1.FileName);

end;

  界面:

delphi編寫提取exe文件的ICO圖標
copyright © 萬盛學電腦網 all rights reserved