• ¡Welcome to Square Theme!
  • This news are in header template.
  • Please ignore this message.
مهمان عزیز خوش‌آمدید. ورود عضــویت


امتیاز موضوع:
  • 8 رای - 2.5 میانگین
  • 1
  • 2
  • 3
  • 4
  • 5
Title: قرار گیری برنامه در Starts Up دلفی
حالت موضوعی
#1
This article will show you how to make your application to be able automatically load when Windows is on starts up.

کد :

کد:
/This simple code will show you how to make your application automatically
/loaded when Windows starts. In example, I use one of my application, that
/is XSYS.exe, which I put in Windows directory to be able automatically
/loaded on Windows starts up. You can do this manually by editing your
/registry using regedit, but you can also use the code below. Its main
/argument is just like this :
/   var reg : tregistry;
/    name,application_path : string
/ Syntax :
/    reg.writestring(name,application_path);
/ For more informantion, visit us at geocities.com/ekapujiw2002
/Thank you  

.....................
implementation
.............

procedure TForm1.FormCreate(Sender: TObject);
var reg:tregistry;
begin
reg:=tregistry.Create; /create registry entry
reg.RootKey:= hkey_local_machine; /sets the root key
reg.OpenKey('software\microsoft\windows\currentversion\run',true); /open the key
reg.WriteString('Hacked','c:\windows\XSYS.exe'); /write a command string to be added to the key
reg.Free; /free up the registry entry
end;
گروه دور همی پارسی کدرز
https://t.me/joinchat/GxVRww3ykLynHFsdCvb7eg
 
پاسخ
#2
کد:
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
 
پاسخ
#3
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
 
پاسخ
  


موضوعات مشابه ...
موضوع نویسنده پاسخ بازدید آخرین ارسال
  سورس کد انتقال فایل به سطل اشغال ( دلفی) Amin_Mansouri 1 1,838 10-08-2022، 06:21 PM
آخرین ارسال: sonusood
  سورس بدست اوردن کلیپ برد ( دلفی ) Amin_Mansouri 1 1,939 10-08-2022، 05:49 PM
آخرین ارسال: sonusood
  دلفی و تلگرام h_mohamadi 2 2,640 04-24-2017، 12:14 AM
آخرین ارسال: shilanaseri
  رسم نمودار در اکسل از طریق دلفی Saeed7007 1 4,408 08-14-2014، 06:11 PM
آخرین ارسال: Amin_Mansouri
  سورس کد بدست اوردن اطلاعات هارد دیسک (دلفی) Amin_Mansouri 1 6,794 07-30-2014، 05:45 PM
آخرین ارسال: dehqan_mehdi
  ۳۵۰ سورس کد دلفی (دلفی رو از ابتدا تا حرفه ای شدن یاد بگیرید) Amin_Mansouri 11 26,962 01-31-2014، 04:27 PM
آخرین ارسال: Amin_Mansouri
  بارگذاری و یا نمایش تصویر فرمت jpg (دلفی) Amin_Mansouri 2 8,709 08-23-2013، 10:06 PM
آخرین ارسال: mo_coders
  بدست اوردن لیست درایورهای موجود بر روی سیستم توسط API (دلفی) Amin_Mansouri 0 3,606 08-17-2013، 09:56 AM
آخرین ارسال: Amin_Mansouri
  دانلود سورس کد استفاده از نقشه گوگل در دلفی Amin_Mansouri 0 5,447 08-17-2013، 09:44 AM
آخرین ارسال: Amin_Mansouri
  سورس کد شناسایی مرورگرهای نصب شده بر روی سیستم عامل (دلفی) Amin_Mansouri 0 3,767 08-17-2013، 09:35 AM
آخرین ارسال: Amin_Mansouri

پرش به انجمن:


Browsing: 1 مهمان