乡下人产国偷v产偷v自拍,国产午夜片在线观看,婷婷成人亚洲综合国产麻豆,久久综合给合久久狠狠狠9

  • <output id="e9wm2"></output>
    <s id="e9wm2"><nobr id="e9wm2"><ins id="e9wm2"></ins></nobr></s>

    • 分享

      delphi 截取關(guān)機(jī)消息

       獨(dú)孤求財(cái) 2012-03-12

      delphi 截取關(guān)機(jī)消息

      時(shí)間:2011-5-30來(lái)源:yang 作者: peng點(diǎn)擊: 35次

      想實(shí)現(xiàn)的目的:當(dāng)按下鍵盤上的Power鍵(關(guān)機(jī))時(shí),系統(tǒng)獲得按鍵關(guān)機(jī)消息,并打出一個(gè)提醒框,如果確認(rèn),則關(guān)機(jī),否則不關(guān)機(jī)。
      在應(yīng)用程序里已實(shí)現(xiàn),但是做成Service程序,安裝成功且已啟動(dòng)之后,并沒(méi)有實(shí)現(xiàn)我要的效果! 請(qǐng)各位大蝦看一下有什么問(wèn)題?能否指點(diǎn)一二?服務(wù)為什么不響應(yīng)系統(tǒng)消息?
      代碼如下:
      unit MyPowerKey;
      interface
      uses
        Windows, Messages, SysUtils, Classes, Graphics, Controls, SvcMgr, Dialogs;

      type
        TPower_Key = class(TService)
          procedure ServiceCreate(Sender TObject);
        private
          { Private declarations }
        public
          function GetServiceController TServiceController; override;
          procedure WMPowerBroadCast(var msg  TMessage);message WM_POWERBROADCAST;鍵盤Power鍵廣播消息
          { Public declarations }
        end;

      var
        Power_Key TPower_Key;

      implementation
      uses MsgBox;
      {$R .DFM}

      procedure TPower_Key.WMPowerBroadCast(var msg TMessage);
      var Form_MsgBox  TForm_MsgBox;
      begin
        SetForeGroundWindow(Application.MainForm.Handle);在應(yīng)用程序里指定主窗口前置,可獲取按鍵消息,服務(wù)沒(méi)有窗口,所以就屏蔽這行了
        Form_MsgBox = TForm_MsgBox.Create(nil);自定義提示窗口
        try
          Form_MsgBox.suiForm1.Caption = ‘提醒框‘;
          Form_MsgBox.HintsLabel.Caption = ‘確認(rèn)是否關(guān)閉系統(tǒng)‘;
          if Form_MsgBox.ShowModal  mrOK then
            msg.Result = BROADCAST_QUERY_DENY;修改消息值,使不關(guān)機(jī)
        finally
          FreeAndNil(Form_MsgBox);
        end;
      end;

      procedure ServiceController(CtrlCode DWord); stdcall;
      begin
        Power_Key.Controller(CtrlCode);
      end;

      function TPower_Key.GetServiceController TServiceController;
      begin
        Result = ServiceController;
      end;

      procedure TPower_Key.ServiceCreate(Sender TObject);
      begin
        Self.Interactive = true;
      end;
      end.  

        本站是提供個(gè)人知識(shí)管理的網(wǎng)絡(luò)存儲(chǔ)空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點(diǎn)。請(qǐng)注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購(gòu)買等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊一鍵舉報(bào)。
        轉(zhuǎn)藏 分享 獻(xiàn)花(0

        0條評(píng)論

        發(fā)表

        請(qǐng)遵守用戶 評(píng)論公約

        類似文章 更多