|Step 5. Testing interactive service|
Apr 11, 2011. Important note. Starting from Windows Vista interactive services are prohibited by Microsoft. Service application can not show forms even if it is marked as Interactive. SvCom suggests a workaround that allows to easily communicate with user from service application. Read more about this opportunity
With previous steps we have created the interactive service. You can test it both in debug mode or in normal service mode. In any case our service will show the form and this form will be visible even if nobody is logged on. To ensure in it restart your computer and wait until service starts. There is only one important note: the Win32 SDK declares that interactive service should detect the logoff event to close all forms. You should take care of it if you really wish to use interactive services. This example DOES NOT show how to do it. As a result Windows will insist on application termination on logoff.
To finalize this example let's look on our service with the help of some process spy utility (Microsoft's SpyXX from SDK set for example). If you don`t have such tool just see on the screenshot below.
As you can see the process of our example (SVCOMEX3) has two threads and both threads contain windows. This windows are Delphi windows (TApplication and TServiceForm). In spite of it they live in different threads without any problems!
|<< | Index | Step 1 | Step 2 | Step 3 | Step 4 | Step 5|