这适用于Win7 / 8,但不适用于XP,为什么?
// uses shlobj;
function GetSpecialFolderPath(Folder: Integer; CanCreate: Boolean): string;
// Gets path of special system folders
//
// Call this routine as follows:
// GetSpecialFolderPath (CSIDL_PERSONAL, false)
// returns folder as result
//
var
FilePath: array [0..255] of char;
begin
SHGetSpecialFolderPath(0, @FilePath[0], FOLDER, CanCreate);
Result := FilePath;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
memo1.Lines.Add('path:|'+GetSpecialFolderPath(CSIDL_ALTSTARTUP, false)+'|')
end;
谢谢