Board index » cppbuilder » How to use tform in TServiceApplication?

How to use tform in TServiceApplication?


2006-03-01 09:19:24 PM
cppbuilder109
I try to use a TForm in a service application, but I get always an exception
error.
I read that in a service applic. a TForm cannot be used, is it true?
If it is true, how can I add a Form to a service?
Thanks
Juan Diego Garcés
 
 

Re:How to use tform in TServiceApplication?

Quote
I read that in a service applic. a TForm cannot be used, is it true?
True. Services are not supposed to have it's interface.
Quote
If it is true, how can I add a Form to a service?
Create a standalone application to communicate with
your service.
Look at ControlService() API.
--
Best Regards,
Vladimir Stefanovic
 

Re:How to use tform in TServiceApplication?

"Juan Diego Garcés" < XXXX@XXXXX.COM >wrote in message
Quote
I try to use a TForm in a service application
Why? A service is not supposed to have any UI at all. Especially if it
runs without a user logged in.
Quote
I get always an exception error.
Without knowing exactly what you are doing, that is likely to be expected.
Borland's service architecture is multi-threaded, and VCL visual controls
cannot be used directly in threads.
Quote
I read that in a service applic. a TForm cannot be used, is it true?
It can be. It depends on exactly how you are trying to use it. It is
technically possible, but there are many things to watch out for.
Quote
If it is true, how can I add a Form to a service?
I would not recommend it.
Gambit
 

{smallsort}

Re:How to use tform in TServiceApplication?

I want to use a TForm to receive broadcast messages. I wrote another
application that send broadcast messages to other applications to notify
there is an alarm in a PLC, I have two applications that have to receive
this message, the first one is a SCADA applic that has to show in a synoptic
image the alarm, and the second one is the service that has to beep.
I write a service because the user has to be notified even the SCADA applic
is stopped. In fact this applic has to run constantly.
Thanks.
"Remy Lebeau (TeamB)" < XXXX@XXXXX.COM >a écrit dans le message de
Quote

"Juan Diego Garcés" < XXXX@XXXXX.COM >wrote in message
news:44059f5d$ XXXX@XXXXX.COM ...

>I try to use a TForm in a service application

Why? A service is not supposed to have any UI at all. Especially if it
runs without a user logged in.

>I get always an exception error.

Without knowing exactly what you are doing, that is likely to be expected.
Borland's service architecture is multi-threaded, and VCL visual controls
cannot be used directly in threads.

>I read that in a service applic. a TForm cannot be used, is it true?

It can be. It depends on exactly how you are trying to use it. It is
technically possible, but there are many things to watch out for.

>If it is true, how can I add a Form to a service?

I would not recommend it.


Gambit


 

Re:How to use tform in TServiceApplication?

ControlService() API can be used to send *custom ID* to the
service application from a TForm.
The service can then receive that *custom ID* and perform some
task (beep).
Best Regards,
Vladimir Stefanovic
 

Re:How to use tform in TServiceApplication?

"Juan Diego Garcés" < XXXX@XXXXX.COM >wrote in message
Quote
I want to use a TForm to receive broadcast messages.
That will not usually work. By default, services run under the context of a
different desktop and workstation then the ones that the user works in.
Window messages cannot be passed between different desktops.
Quote
I wrote another application that send broadcast messages to other
applications to notify there is an alarm in a PLC, I have two applications
that have to receive this message, the first one is a SCADA applic that
has to show in a synoptic image the alarm, and the second one is the
service that has to beep.
Use the ControlService() function to send messages to a service. You can
override the TService's DoCustomControl() methof to handle custom messages.
Then have either the broadcasting application notify the service directly,
or else have the receiving application notify the service when itself is
notified.
Quote
I write a service because the user has to be notified even the
SCADA applic is stopped.
Then you need to have the broadcasting application notify the service
directly.
Gambit