Claire,
Generally speaking, this is a VERY bad idea. Performing UI operations
from a service is very bad practice. The reason for this is that you can
not guarantee that a service will actually have an interactive user session
to show the messagebox to.
If anything, you should have some way of communicating with the service.
The easiest way to do that is to expose an object through remoting. Then,
you can have an agent that runs on another machine (or the same machine),
which can connect to the service through remoting, and be notified when
necessary. The agent would then show the UI.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
-
mv*@spam.guard.caspershouse.com
"Claire" <cz*********@community.nospam> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
I've written a Windows Service application that monitors input through a
com port.
It's been requested that I add a dialog box so that, should anyone need to
watch the input for troubleshooting reasons, they can.
I remember that I had to call a version of the MessageBox() function that
uses MessageBoxOptions = "ServiceNotification" on one occasion because it
was being called in context of a service application.
Are there any special procedures I have to follow for showing a user
defined dialog from a service?