//只要把程序添加到'\software\microsoft\windows\CurrentVersion\Run'下就行了。 procedure TForm1.Button1Click(Sender: TObject); var run:TRegistry; begin try run:=TRegistry.Create; run.RootKey:=HKEY_LOCAL_MACHINE ; if run.OpenKey('\software\microsoft\windows\CurrentVersion\Run',false) then run.WriteString('notepad','c:\windows\notepad.exe'); finally//run.WriteString('Delphi App',Application.exename); run.Free; end; end;
procedure TForm1.Button1Click(Sender: TObject);
var
run:TRegistry;
begin
try
run:=TRegistry.Create;
run.RootKey:=HKEY_LOCAL_MACHINE ;
if run.OpenKey('\software\microsoft\windows\CurrentVersion\Run',false) then
run.WriteString('notepad','c:\windows\notepad.exe');
finally//run.WriteString('Delphi App',Application.exename);
run.Free;
end;
end;
Uses Registry;
读不了运行程序所需的INI文件。
uses Registry;
然后在注册表中可以有三处进行修改都能够添加程序自动运行;
具体的忘记了,你可以自己搜索一下,run