Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > General

Lost Password?

Reply
 
Thread Tools Display Modes
  #1  
Old 01-24-2001, 10:36 PM
User 850 User 850 is offline
Member
 
Join Date: Jan 2001
Posts: 71
Default 'Autorun'-component by ABF-software

Hi,

I am using the 'Autorun'-component by ABF-software to run my app at system startup, and it works great... But my question is;
How can I autorun my program with a command-line, so that I can find out if the program was autostarted or manualy executed?
I have mailed ABF-Software, but didn't get an answer, so I was hoping someone else had a solution...

Thanks in advance
//Daniel
Reply With Quote
  #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
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT. The time now is 08:57 PM.


Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2019, vBulletin Solutions, Inc.