全國最多中醫師線上諮詢網站-台灣中醫網
發文 回覆 瀏覽次數:1466
推到 Plurk!
推到 Facebook!

在 Service application 如何得知 Server 正在關機

尚未結案
xBaby
一般會員


發表:1
回覆:15
積分:8
註冊:2002-08-14

發送簡訊給我
#1 引用回覆 回覆 發表時間:2002-09-30 01:01:55 IP:163.16.xxx.xxx 未訂閱
我寫了一個 Service 的程式,可以正常的啟動及停止; 但當該Service 於啟動狀態下將 Server 關機時,就無法關機成功, Service 停止便可以關機。 請問,我要該如何做才能在啟動狀態下關機呢?
RaynorPao
版主


發表:139
回覆:3622
積分:7025
註冊:2002-08-12

發送簡訊給我
#2 引用回覆 回覆 發表時間:2003-06-02 11:22:51 IP:203.73.xxx.xxx 未訂閱
引言: 我寫了一個 Service 的程式,可以正常的啟動及停止; 但當該Service 於啟動狀態下將 Server 關機時,就無法關機成功, Service 停止便可以關機。 請問,我要該如何做才能在啟動狀態下關機呢?
xBaby 你好: 請參考以下連結文章(BCB 版本的 Service Application)
------
-- 若您已經得到滿意的答覆,請適時結案!! --
-- 欲知前世因,今生受者是;欲知來世果,今生做者是 --
-- 一切有為法,如夢幻泡影,如露亦如電,應作如是觀 --
xBaby
一般會員


發表:1
回覆:15
積分:8
註冊:2002-08-14

發送簡訊給我
#3 引用回覆 回覆 發表時間:2003-06-06 09:31:47 IP:61.70.xxx.xxx 未訂閱
感謝您的答覆 但由於我的程式是一個不斷作業中的 >
pgdennis
資深會員


發表:41
回覆:526
積分:443
註冊:2002-05-23

發送簡訊給我
#4 引用回覆 回覆 發表時間:2003-06-07 17:04:50 IP:61.59.xxx.xxx 未訂閱
不知這是不是你要的  
 
Detecting Windows Shutdown    To detect Windows Shutdown, you must trap WM_EndSession message. These steps should be taken: 
Declare a message handling procedure in your Form's Private section:     procedure WMEndSession(var Msg : TWMEndSession); message WM_ENDSESSION;     Add the procedure to the implementation section of your Unit:     procedure TForm1.WMEndSession(var Msg : TWMEndSession); 
begin 
  if Msg.EndSession = TRUE then 
    ShowMessage('Windows is shutting down '   #13   'at '   
      FormatDateTime('c', Now)); 
  inherited; 
end;     Tip submitted by Steve Harman         Detecting Windows shutdown
When Windows is shutting down, it sends a WM_QueryEndSession to all 
open applications. To detect (and prevent shutdown), you must define 
a message handler to this message. Put this definition on the private section of the main form:         procedure WMQueryEndSession(var Msg : TWMQueryEndSession); message WM_QueryEndSession; 
And put this method in the implementation section of the unit:     procedure TForm1.WMQueryEndSession(var Msg : TWMQueryEndSession); 
begin 
  if MessageDlg('Close Windows ?', mtConfirmation, [mbYes,mbNo], 0) = mrNo then 
    Msg.Result := 0 
  else 
    Msg.Result := 1; 
end;     http://www.geocities.com/SiliconValley/8055/tips.htm#tip19
永遠追不上技術更新的速度~~ 發表人 - pgdennis 於 2003/06/07 17:08:46
------
星期一,二...無窮迴圈@@
xBaby
一般會員


發表:1
回覆:15
積分:8
註冊:2002-08-14

發送簡訊給我
#5 引用回覆 回覆 發表時間:2003-06-11 01:30:57 IP:211.75.xxx.xxx 未訂閱
感謝 pgdennis 的回答,我會試試看的。
系統時間:2024-05-20 10:31:04
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!