type
TForm1 = class(TForm)
Button1: TButton;
Image1: TImage;
OpenDialog1: TOpenDialog;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
uses
Registry, ShellApi;
function StrLeft(const mStr: string; mDelimiter: string): string;
begin
Result := Copy(mStr, 1, Pos(mDelimiter, mStr) - 1);
end; { StrLeft }
function StrRight(const mStr: string; mDelimiter: string): string;
begin
if Pos(mDelimiter, mStr) <= 0 then
Result := ''
else Result := Copy(mStr, Pos(mDelimiter, mStr) + Length(mDelimiter), MaxInt);
end; { StrRight }
function FileIcon(mFileName: TFileName): THandle; { 返回文件的图标 }
var
vRegistry: TRegistry;
vExtension, vIconFileName: TFileName;
vIconIndex: Integer;
vExtDescription: string;
var
vBuffer: array[0 .. MAX_PATH] of Char;
vSysPath: string;
begin
Result := 0;
if not FileExists(mFileName) then Exit;