Arne Fl. Jensen wrote:
> Hi all,
> 
> 
> I try to create a windows service with Httpserver. I have used the
> example in the OverbyteIcsSrvTcp1 project, with a separate unit
> OverbyteIcsCmd. In the last mentioned - in my version I use
> Thttpserver.  Here are two events; ClientConnect and ClientDisConnect
> witch use "postmessage (Handle, WM_CLIENT_COUNT, 0, 0)". I have a
> messagepump like this: 

You do not need a message pump in TService, both main and service
thread process messages. If you drop the component on the TService
data module server events trigger in main thread, if you create
the component in i.e. OnServiceStart  at run-time events are triggered
in the service thread. The WM_CLIENT_COUNT message is a custom
message declared in the demo and sent to mainform's window handle.

Since there are no windows in a TService application but the hidden
ICS window(s) by default you have to either register your custom
message in a derived THttpServer class and override its WndProc method
and the post the custom message to server's window handle or you create
your own hidden window (see Classes.AllocateHWnd) and use that as the
destination window.

My enhanced service framework DDService might help you as it has a 
property that creates a hidden window in the service thread. It also
allows to use custom service controls which are simply windows
messages posted to the service thread. Something like:
PostThreadMessage(<ServiceThreadID>, CM_SERVICE_CONTROL_CODE, 
<user-defined control code in the range 128 to 255>, <a LParam>).
would trigger event OnCustomControl.

http://www.duodata.de/misc/delphi/DDService.zip

 
-- 
Arno Garrels


--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to