Delphi開發Windows服務程式

2022-06-23 08:30:12 字數 982 閱讀 8873

開發步驟:

2、現在乙個服務程式的框架已經搭起來了

開啟service1視窗,有幾個屬性說明一下:

allowpause:是否允許暫停

allowstop: 是否允許停止

dependencies: 設定服務的依存關係,服務的啟動是否依賴於某個服務或者組

displayname: 在「服務」視窗顯示的名稱

interactive: 設定為true時可以和windows桌面進行互動,如果我們想在服務裡顯示窗體的話此設定就要設定為true,

另外servicetype必須為stwin32

password: 密碼

starttype: 啟動方式

3、如果我們想讓服務與窗體互動,步驟如下:

在工程中新建乙個窗體fmmain 然後在service1的onstart中寫**

procedure  tservice1.servicestart(sender: tservice; var started:  boolean);

begin

started := true;

fmmain.show;

end;

onstop的**

procedure tservice1.servicestop(sender: tservice; var stopped:  boolean);

begin

stopped :=  true;

fmmain.free;

end;

這樣在服務啟動的時候就會顯示出新建的那個窗體

4、編譯完成後,我們可以安裝服務了,安裝方法為:

關於其他:

forms,

svcmgr,

工程初始化

Delphi開發Windows服務程式

開發步驟 2 現在乙個服務程式的框架已經搭起來了 開啟service1視窗,有幾個屬性說明一下 allowpause 是否允許暫停 allowstop 是否允許停止 dependencies 設定服務的依存關係,服務的啟動是否依賴於某個服務或者組 displayname 在 服務 視窗顯示的名稱 i...

Delphi原生Windows程式

使用windows api編寫原生windows程式 program project3 uses winapi.windows,winapi.messages,system.sysutils const function windowproc window hwnd amessage uint wp...

Delphi專案開發和Delphi學習筆記索引

最近準備做乙個用delphi客戶端呼叫.net的webservice的專案。所以把專案開發計畫和學習計畫寫在部落格上。希望對自己的技術有個促進。因為網上用delphi客戶端呼叫.net的webservice的專案和資料並不多,再加上我也沒做過客戶端程式,所以一些東東還要靠自己去鑽研。大致的計畫如下。...