Board index » cppbuilder » Problem Creating Service Application with User Interface
Problem Creating Service Application with User Interface
2004-08-18 11:10:18 PM
I'm using C++Builder 6, and I'm trying to create a simple service
application that establishes a TCP connection with any specified IP address
or host name periodically, to check for network connectivity and uptime. It
needs to be a service application so it is running before logon and after
logoff of a Windows user name, and so it automatically starts up after
rebooting. It needs to have a user interface so that the settings can be
I tried starting with the Service Application project from File..New..Other.
I added a form and a TTrayIcon component, and everything works fine if I run
them inside a non-service application project. But the form does not behave
correctly within the service application. When I run the program, the system
tray icon appears, and I use the popup menu I put on it to show the form.
This all works fine. But, when I try to close the form, the form window
freezes. When I try to minimize it, it disappears to the tray icon as it
should, but then I can't get it back. So I'm guessing there's something
about a service application that doesn't work well with windowed forms.
Is there any way to get a form to display properly within a service
application? Also, since the service would start up before login, before a
desktop and system tray are created, is there any way of determining whether
they are created yet, and is there some kind of event that fires when login
causes this creation? If there were a way of doing this, when the program is
executed, I could display the tray icon if someone was logged in, and if
not, wait until the event for login fires to display it.