如何获得  『开始菜单』→『所有程序』→『启动』 这个目录的路径? 

解决方案 »

  1.   

    uses
      shlobj;function SHGetFolderPath( hwndOwner: HWND;
                              nFolder: Integer;
                              hToken: THandle;
                              dwFlags: DWORD;
                              pszPath: PAnsiChar
                          ): HRESULT; stdcall; external 'shell32.dll' name 'SHGetFolderPathA';
    var
      Path: AnsiString;
    begin
      SetLength(Path, MAX_PATH);
      if Failed(SHGetFolderPath(Handle,CSIDL_COMMON_STARTUP  (*所有用户,如果是当前用户,则换成CSIDL_STARTUP*),0,0,PAnsiChar(Path))) then
      SetLength(Path,StrLen(PAnsiChar(Path)));
      ShowMessage(Path);
    end;