K
K
Unregistered / Unconfirmed
GUEST, unregistred user!
在DFW BBS上查了很资料,自己理解成下面的写法,可是收不到消息,请各位帮帮我,谢谢。<br>type<br> TsvcSQLServerBackup = class(TService)<br> procedure ServiceStart(Sender: TService; var Started: Boolean);<br> private<br> FHandle:THandle;<br> <br> procedure WndProc(var Msg:TMessage);<br> <br> function WriteEvents(ALogName: string; AEvent: string): Boolean;<br> public<br> Constructor Create;<br> Destructor Destroy; override;<br> property Handle: THandle read FHandle;<br> function GetServiceController: TServiceController; override;<br> { Public declarations }<br> end;<br><br><br>constructor TsvcSQLServerBackup.Create;<br>begin<br> FHandle := AllocateHwnd(WndProc);<br>end;<br><br>destructor TsvcSQLServerBackup.Destroy;<br>begin<br> DeallocateHWnd(FHandle);<br> inherited;<br>end;<br><br>procedure TsvcSQLServerBackup.WndProc(var Msg: TMessage);<br>begin<br> if Msg.Msg = RegisterWindowMessage(WM_WindowMessage) then<br> showmessage('ok');<br>end;<br><br>//在另一个程序中发消息<br>SendMessage(HWND_BROADCAST,RegisterWindowMessage(WM_WindowMessage),0,0);