频道分类

Delphi 获取系统启动文件夹路径

作者:admin 来源: 日期:2019/10/8 10:58:12 人气: 标签:

 
 uses  ShlObj, ShellAPI;

function GetAutoRunFilePath(): String;
var
  fileName, pathStartUp: String;
  path: array [0 .. 255] of Char;
begin
  if SHGetSpecialFolderPath(0, @path[0], CSIDL_STARTUP, true) then
    pathStartUp := String(path);

  Result := pathStartUp + PathDelim + fileName;
end;


procedure TForm1.FormCreate(Sender: TObject);
begin

form1.Caption:=GetAutoRunFilePath;
end;