如题

解决方案 »

  1.   

    在程序中调出“文件属性”的对话框 
     
    unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls, Shellapi;type
      TForm1 = class(TForm)
        Button1: TButton;
        procedure Button1Click(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;function ShowFileProperties(FileName: String; Wnd: HWND):Boolean;
    var
      Form1: TForm1;implementation{$R *.dfm}
    function SHFileProperties(handle:hwnd;uflags:dword;name:pchar;str:pchar):dword;stdcall;external 'shell32.dll' index 178;function ShowFileProperties(FileName: String; Wnd: HWND):Boolean;
    var sfi: TSHELLEXECUTEINFO;
    begin
      with sfi do begin
        cbSize := SizeOf(sfi);
        lpFile := PAnsiChar(FileName);
        Wnd := Wnd;
        fMask := SEE_MASK_NOCLOSEPROCESS or SEE_MASK_INVOKEIDLIST or SEE_MASK_FLAG_NO_UI;
        lpVerb := PAnsiChar('properties');
        lpIDList := nil;
        lpDirectory := nil;
        nShow := 0;
        hInstApp := 0;
        lpParameters := nil;
        dwHotKey := 0;
        hIcon := 0;
        hkeyClass := 0;
        hProcess := 0;
        lpClass := nil;
      end;
      Result := ShellExecuteEX(@sfi);
    end;procedure TForm1.Button1Click(Sender: TObject);
    begin
    ShowFileProperties('c:\boot.ini',handle);
    end;end.