これは 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;
ありがとう