Posted by: Christian Wimmer in: Common
If you create a COM Server to serve some clients with COM interfaces (or better their functionality), you maybe get sometimes a dialog box that tells you that there are client connections opened. This happens as soon as you try to close your app. If you want to close it though, you have to explicitly click “Yes”.
You can prevent this dialog box by setting the property UIInteractive of TComServer to true. The COM Server instance is defined in unit ComServ by the instance variable ComServer. It also sets ObjectCount which defines the remaining client COM connections. The dialog pops up if this value is greater than zero. In this way you can easily check yourself the whole circumstance and show a dialog yourself if you need it.
Consider what happens if a dialog box appears in your service app. I did some tests in Windows Vista and found out that the dialog box prevented the service process to be terminated although the service shuts down correctly. So I just set UIInteractive to false and it worked fine.
Remember: If a service must be shut down it should do it as fast as possible.