当打开一个文件时,如何样才能获得这个文件的图标

当打开一个文件时,怎么样才能获得这个文件的图标
opendialog选择一个文件,随即就调用这个文件的ico到Image中
      关键是怎么知道选择这个文件的ico,怎么获取!

------解决方案--------------------
function GetFileIcon(FileName: string): integer;
var
Thepchar: PChar;
Theicon: ticon;
Dummy:word;
begin
Dummy := 65535;
GetMem(Thepchar,255);
try
strpcopy(Thepchar,FileName);
Theicon := Ticon.Create;
Theicon.Handle := extractassociatedicon(Hinstance,Thepchar,Dummy);
try
Result := ImageList.AddIcon(Theicon);
finally
Theicon.Free;
end;
finally
FreeMem(Thepchar,255);
end;
end;

------解决方案--------------------
GetBitmap
GetIcon