see.....
ExtractIcon or ExtractIconEx or ExtractAssociatedIcon
DrawIcon or DrawIconEx
这方面的例子好多,搜一下先~~
........

解决方案 »

  1.   

    不需要,只要使用ExtractIcon()就可以了。
      

  2.   

    unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, ExtCtrls, StdCtrls;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;  GetSystemDirectory(vBuffer, MAX_PATH + 1);
      vSysPath := string(vBuffer) + '\';  vRegistry := TRegistry.Create;
      try
        vExtension := UpperCase(ExtractFileExt(mFilename));
        if (vExtension = '.EXE') or (vExtension = '.ICO') then begin
          vIconFileName := mFilename;
          vIconIndex := 0;
        end else begin
          vRegistry.RootKey := HKEY_CLASSES_ROOT;
          if vRegistry.OpenKey(vExtension, False) then begin
            vExtDescription := vRegistry.ReadString('');
            vRegistry.OpenKey('\' + vExtDescription, False);
            vRegistry.OpenKey('DefaultIcon', False);
            vIconFileName := vRegistry.ReadString('');
            vIconIndex := StrToIntDef(StrRight(vIconFileName, ','), 0);
            vIconFileName := StrLeft(vIconFileName, ',');
          end else begin
            vIconFileName := vSysPath + 'Shell32.dll';
            vIconIndex := 0;
          end;
        end;
        Result := ExtractIcon(HInstance, PChar(vIconFileName), UINT(vIconIndex));
      finally
        vRegistry.Free;
      end;
    end; { FileIcon }procedure TForm1.Button1Click(Sender: TObject);
    begin
      if OpenDialog1.Execute then
        Image1.Picture.Icon.Handle := FileIcon(OpenDialog1.FileName);
    end;end.
      

  3.   

    zswang(伴水)的程序太详细了吧真实好人啊