01-10-2012، 11:30 PM
کد:
unit Unit1;
interface
uses
Windows, Registry, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TForm1 = class(TForm)
StaticText1: TStaticText;
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure RunOnStartup(sProgTitle,sCmdLine: string;bRunOnce : boolean );
var
sKey : string;
reg : TRegIniFile;
begin
if( bRunOnce )then
sKey := 'Once'
else
sKey := '';
reg := TRegIniFile.Create( '' );
reg.RootKey := HKEY_LOCAL_MACHINE;
reg.WriteString(
'Software\Microsoft'
+ '\Windows\CurrentVersion\Run'
+ sKey + #0,
sProgTitle,
sCmdLine );
reg.Free;
end;
//Usage:
//sProgTitle:
//Name of your program. Generally speaking, this could be anything you want.
//sCmdLine:
//This is the full path name to your executable program.
//bRunOnce:
//Set this to True if you want to run your program just once.
//If this parameter is False, specified program will be
//executed every time Windows starts up.
procedure TForm1.FormCreate(Sender: TObject);
begin
RunOnStartup(
'Hello',
'c:\hello\Hello.exe',
False);
end;
end.
گروه دور همی پارسی کدرز
https://t.me/joinchat/GxVRww3ykLynHFsdCvb7eg
https://t.me/joinchat/GxVRww3ykLynHFsdCvb7eg