View Single Post
  #2  
Old 01-25-2001, 07:15 AM
BlakeBlake BlakeBlake is offline
Senior Member
 
Join Date: Jan 2001
Posts: 156
Default RE: 'Autorun'-component by ABF-software

use parameters, and check for those parameters in your program


for i:= 1 to parametercount do
begin
if paramstr(i) = 'runbyabfcomponents' then
runautomatically:= true
else
runautomatically:= false;
//-- eg a parameter passed by the abf components
end;

the parameter must be executed by the auto run component, if there is not a property for this then try thew code below

uses Registry;

var
RegistryFile : TRegistry;

Procedure OpenRegistry(root : hkey);
Begin
RegistryFile:= Tregistry.Create;
RegistryFile.RootKey:= root;
End;
//---------------------------------------------------------------------------
Procedure CloseRegistry;
Begin
RegistryFile.CloseKey;
RegistryFile.Free;
End;
//---------------------------------------------------------------------------
procedure run_on_startup(enabled : boolean);
begin
OpenRegistry(HKEY_LOCAL_MACHINE);
RegistryFile.LazyWrite := false;
RegistryFile.OpenKey(regstr_path_run,false);
if enabled and (not RegistryFile.ValueExists('Program name')) then
RegistryFile.WriteString(''Program name',Application.exename)
else
RegistryFile.DeleteValue('QuickChanger');
CloseRegistry;
end;

just pass a boolean parameter to run_on_startup() and it will update the registry for you
Reply With Quote