01-10-2012، 11:34 PM
Run Program On Startup (Registry)
کد:
!**************************************
! Name: Run Program On Startup (Registry)
! Description:Places your program in the Windows Registry so it will run at startup.
! By: CrAcKeR
!
!This code is copyrighted and has! limited warranties.Please see http://www.Planet-Source-Code.com/vb/scripts/ShowCode.asp?txtCodeId=144&lngWId=7!for details.!**************************************
// Place registry in your USES
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, registry, StdCtrls;
// This is the procedure (False means remove, True means create)
procedure RunOnStartup(sProgTitle, sCmdLine: string; bStartup: boolean );
var
sKey: string;
reg : TRegIniFile;
begin
sKey := ''; //sKey := 'Once' if you wish it to only run on the next time you startup.
if bStartup = false then //If value passed is false, then value deleted from Registry.
begin
try
reg := TRegIniFile.Create( '' );
reg.RootKey := HKEY_LOCAL_MACHINE;
reg.DeleteKey(
'Software\Microsoft'
+ '\Windows\CurrentVersion\Run'
+ sKey + #0,
sProgTitle);
reg.Free;
exit;
except //Using Try Except so that if value can not be placed in registry, it
//will not give and error.
end;
end;
try
reg := TRegIniFile.Create( '' );
reg.RootKey := HKEY_LOCAL_MACHINE;
reg.WriteString(
'Software\Microsoft'
+ '\Windows\CurrentVersion\Run'
+ sKey + #0,
sProgTitle,
sCmdLine );
reg.Free;
except
end;
end;
گروه دور همی پارسی کدرز
https://t.me/joinchat/GxVRww3ykLynHFsdCvb7eg
https://t.me/joinchat/GxVRww3ykLynHFsdCvb7eg