没有form的Service Application,想得到关机消息WM_QueryEndSession,应该怎么做?好像得不到啊

解决方案 »

  1.   

    可以得到,
     AllocateHWnd(WM_QueryEndSession)
      

  2.   

    type TForm1 = class(TForm) procedure WMQueryEndSession(var Message: TWMQueryEndSession); message WM_QUERYENDSESSION; procedure CMEraseBkgnd(var Message:TWMEraseBkgnd);Message WM_ERASEBKGND; private { Private declarations } public { Public declarations } end; procedure TForm1.WMQueryEndSession(var Message: TWMQueryEndSession); begin Showmessage('computer is about to shut down'); end;