Wilfried Mestdagh wrote:
> Hello Paul,
>
>> That's was my first impression also, however RPPollSvc.Handle doesn't
>> exist :-(
>
> Correct. TService is derrived from TDataModule and has no windows
> handle. However you can make one with AllocateHWND.
That's probably the best way.
If you need to receive custom messages in ServiceThread's pump, why?
you could do something like this:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, SvcMgr, Dialogs;
type
TService1 = class(TService)
procedure ServiceExecute(Sender: TService);
protected
function DoCustomControl(CtrlCode: DWord): Boolean; override;
private
{ Private-Deklarationen }
public
function GetServiceController: TServiceController; override;
{ Public-Deklarationen }
end;
var
Service1: TService1;
implementation
{$R *.DFM}
procedure ServiceController(CtrlCode: DWord); stdcall;
begin
Service1.Controller(CtrlCode);
end;
function TService1.DoCustomControl(CtrlCode: DWord): Boolean;
begin
if CtrlCode = 256 then
beep
end;
function TService1.GetServiceController: TServiceController;
begin
Result := ServiceController;
end;
procedure TService1.ServiceExecute(Sender: TService);
begin
while not terminated do
begin
ServiceThread.ProcessRequests(False);
PostThreadMessage(ServiceThread.ThreadID, CM_SERVICE_CONTROL_CODE, 256,
0);
sleep(500);
end;
end;
I think CtrlCode 128..255 is reserved.
---
Arno Garrels [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be