D
DelphiFish
Unregistered / Unconfirmed
GUEST, unregistred user!
偶写了一个XX:
unit Unit1;
interface
uses
; Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
; Dialogs, StdCtrls,ShellApi;
type
; TForm1 = class(TForm)
; ; Button1: TButton;
; ; OpenDialog1: TOpenDialog;
; ; procedure Button1Click(Sender: TObject);
; ; procedure GetIcon(FileName:TFileName);
; private
; ; { Private declarations }
; public
; ; { Public declarations }
; end;
type
; TMyIcon = class(TIcon)
; private
; ;phiconLarge:HICON;
; ;phiconSmall:HICON;
; ;end;
var
; Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
; ;if OpenDialog1.Execute then GetIcon(OpenDialog1.FileName);
end;
procedure TForm1.GetIcon(FileName:TFileName);
var
;MyIcon:TMyIcon;
begin
; MyIcon:=TMyIcon.Create;
; MyIcon.Handle:=extractIconEx(PChar(FileName),-1,MyIcon.phiconLarge,MyIcon.phIconSmall,3);
; MyIcon.SaveToFile('c:/ico.ico');
end;
end.
为什么MyIcon.Handle不管我选定什么文件始终是返回1,ft,帮助中解释是If the file specified was not an executable file, DLL, or icon file, the return value is 1.
ft![]
unit Unit1;
interface
uses
; Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
; Dialogs, StdCtrls,ShellApi;
type
; TForm1 = class(TForm)
; ; Button1: TButton;
; ; OpenDialog1: TOpenDialog;
; ; procedure Button1Click(Sender: TObject);
; ; procedure GetIcon(FileName:TFileName);
; private
; ; { Private declarations }
; public
; ; { Public declarations }
; end;
type
; TMyIcon = class(TIcon)
; private
; ;phiconLarge:HICON;
; ;phiconSmall:HICON;
; ;end;
var
; Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
; ;if OpenDialog1.Execute then GetIcon(OpenDialog1.FileName);
end;
procedure TForm1.GetIcon(FileName:TFileName);
var
;MyIcon:TMyIcon;
begin
; MyIcon:=TMyIcon.Create;
; MyIcon.Handle:=extractIconEx(PChar(FileName),-1,MyIcon.phiconLarge,MyIcon.phIconSmall,3);
; MyIcon.SaveToFile('c:/ico.ico');
end;
end.
为什么MyIcon.Handle不管我选定什么文件始终是返回1,ft,帮助中解释是If the file specified was not an executable file, DLL, or icon file, the return value is 1.
ft![]