delphi 設定開機自動啟動函式

2021-08-31 16:31:48 字數 752 閱讀 4991

procedure tmainform.setautorun(ok: boolean);

varreg:tregistry;       //首先定義乙個tregistry型別的變數reg

begin

reg:=tregistry.create;

try                           //建立乙個新鍵

reg.rootkey:=hkey_local_machine;     //將根鍵設定為hkey_local_machine

reg.openkey('software\microsoft\windows\currentversion\run',true);//開啟乙個鍵

if ok then begin

reg.writestring('sms服務',expandfilename(paramstr(0)));           //在reg這個鍵中寫入資料名稱和資料數值

showmessage('註冊成功!'); 

endelse begin

reg.deletevalue('sms服務');

showmessage('刪除成功!') 

end;

reg.closekey;       //關閉鍵

finally

reg.free;

end;

end;

例子:setautorun(true);   //註冊啟動

setautorun(false);   //刪除啟動

設定Apache開機自動啟動

如何讓apache隨linux啟動而啟動的方法做個總結,總結如下 1 cd etc init.d 2 vi apache2 3 貼上以下 bin sh description apache auto start stop script.chkconfig 85 15 apache home usr ...

設定nginx開機自動啟動

首先,在linux系統的 etc init.d 目錄下建立nginx檔案,使用如下命令 vim etc init.d nginx 按照官網指令碼,編輯指令碼內容。修改nginx usr local nginx sbin nginx 修改為自己安裝nginx的啟動指令碼 nginx config fi...

linux設定開機服務自動啟動

linux設定開機服務自動啟動 root localhost chkconfig list 顯示開機可以自動啟動的服務 root localhost chkconfig add 新增開機自動啟動 服務 root localhost chkconfig del 刪除開機自動啟動 服務 www.2cto...