请问,通过什么函数可以获取PROGRAM FILES的安装路径。

解决方案 »

  1.   

    PROGRAM FILES ?讲清楚点吗!
      

  2.   

    uses Registry;procedure TForm1.FormCreate(Sender: TObject);
    begin
      with TRegistry.Create do try
        RootKey := HKEY_LOCAL_MACHINE;
        if OpenKey('Software\Microsoft\Windows\CurrentVersion', False) then
          Caption := ReadString('ProgramFilesDir')
      finally
        Free;
      end;
    end
      

  3.   

    procedure TForm1.Button1Click(Sender: TObject);
    var
      exInfo: PItemIDList;
      ProPath : array[0..MAX_PATH] of char;
    begin
      SHGetSpecialFolderLocation(Application.Handle, CSIDL_PROGRAMS, exInfo);
      SHGetPathFromIDList(exInfo, ProPath);
      edit1.Text := ProPath;
    end;需要引用ShellAPI, shlobj