Delphi創立開機啟動項的辦法示例。本站提示廣大學習愛好者:(Delphi創立開機啟動項的辦法示例)文章只能為提供參考,不一定能成為您想要的結果。以下是Delphi創立開機啟動項的辦法示例正文
Delphi可以經過創立開機啟動項鍵值的辦法,將順序添加到開機啟動項中。經過本實例代碼就可以為您的順序添加到疾速啟動中,隨著Windows一同啟動,開機即運轉的順序。該實例代碼復雜,次要是經過添加注冊表鍵值來完成。
詳細的功用代碼如下所示:
unit dy97; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs,registry, StdCtrls, ExtCtrls; type TForm1 = class(TForm) Label1: TLabel; Image1: TImage; procedure FormCreate(Sender: TObject); private { Private declarations } public { Public declarations } procedure zdyx(a,b: string;c: boolean); end; var Form1: TForm1; implementation {$R *.dfm} { TForm1 } procedure TForm1.zdyx(a, b: string; c: boolean); var d: string; e: TReginiFile; begin if c then d := 'once' else d:= ''; e := TRegIniFile.Create(''); e.RootKey := HKEY_LOCAL_MACHINE; e.WriteString('software\microsoft\windows\currentversion\run'+d +#0,a,b); e.Free ; end; procedure TForm1.FormCreate(Sender: TObject); begin self.zdyx('ZDYX',application.ExeName,false); end; end.