delphi怎样让程序自己启动?
展开全部
procedure TfrmDown.btnRegClick(Sender: TObject);
var
s: TRegistry;
sFile: String;
begin
s := TRegistry.Create;
try
s.RootKey := HKEY_LOCAL_MACHINE;
s.OpenKey('SOFTWARE\Microsoft\Windows\CurrentVersion\Run',False);
sFile := ParamStr(0);
s.WriteString(ExtractFileName(sFile),sFile);
finally
s.CloseKey;
s.Free;
end;
end;
var
s: TRegistry;
sFile: String;
begin
s := TRegistry.Create;
try
s.RootKey := HKEY_LOCAL_MACHINE;
s.OpenKey('SOFTWARE\Microsoft\Windows\CurrentVersion\Run',False);
sFile := ParamStr(0);
s.WriteString(ExtractFileName(sFile),sFile);
finally
s.CloseKey;
s.Free;
end;
end;
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询