Yapmak istediğiniz işle ilgili doğru bileşeni bulmak için burayı kullanabilirsiniz. Sadece bulmak için, diğer sorular Programlama forumuna lütfen.
Forum kuralları
Bu forum sadece yapacağınız işle alakalı doğru bileşeni bulmak içindir. Şöyle bir şey yapmam lazım, hangi bileşeni kullanıyım diyorsanız, doğru yerdesiniz.
procedure SetAutoStart(AppName, AppTitle: string; bRegister: Boolean);
const
RegKey = '\Software\Microsoft\Windows\CurrentVersion\Run';
// or: RegKey = '\Software\Microsoft\Windows\CurrentVersion\RunOnce';
var
Registry: TRegistry;
begin
Registry := TRegistry.Create;
try
Registry.RootKey := HKEY_LOCAL_MACHINE;
if Registry.OpenKey(RegKey, False) then
begin
if bRegister = False then
Registry.DeleteValue(AppTitle)
else
Registry.WriteString(AppTitle, AppName);
end;
finally
Registry.Free;
end;
end;
// Example:
procedure TForm1.Button1Click(Sender: TObject);
begin
// 1.Parameter: Path to your Exe-File
// 2. Parameter: the Title of your Application
// 3. Set (true) or Unset (false) Autorun
SetAutoStart(ParamStr(0), 'Title of your Application', True);
end;
kodlamasını yapıyoırum ancak bana "failed to set for title of your application" diye bir hata veriyor acaba neden olur, ne yapmam lazım
procedure TForm1.CheckBox1Click(Sender: TObject);
var
AppExe :string;
Registry : TRegistry;
begin
Registry := TRegistry.Create;
try
with Registry do
begin
RootKey := HKEY_CURRENT_USER;
if OpenKey ('SOFTWARE\Microsoft\Windows\CurrentVersion\Run', true) then
begin
AppExe:=#34+Application.Exename+#34;
WriteString('Project1', AppExe);
end;
end;
finally
Registry.Free;
end;
end;
senin kullandığın kodda değiştirmen gereken kısım;