471,319 Members | 1,931 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,319 software developers and data experts.

Showing forms within a Windows Service

OK so I built this Windows Service which was able to use
MessageBox.Show to present text to the user from within the service. I
had to use a special property though within that method- which is
MessageBoxOptions.ServiceNotification.

Now I'd like to create a custom form and have the service show it, to
administer settings of that service. How do I do this? I tried creating
a simple form and instatiating it then calling Application.run(form) on
it, but nothing happened. No error seemed to occur either because I'm
not getting the output from my exception handler in the event logs...

Any ideas?

Dec 15 '05 #1
3 7596
tman,

You don't want to do this. Services do not depend on an interactive
user session in order to run, they are always running, whether or not
someone is logged in or not.

What you want to do is have a program running in the interactive user
session which uses remoting to communicate with the service. The service
can then send a message to the program that is running, and have it display
a form from there.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"tman" <tl*****@gmail.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
OK so I built this Windows Service which was able to use
MessageBox.Show to present text to the user from within the service. I
had to use a special property though within that method- which is
MessageBoxOptions.ServiceNotification.

Now I'd like to create a custom form and have the service show it, to
administer settings of that service. How do I do this? I tried creating
a simple form and instatiating it then calling Application.run(form) on
it, but nothing happened. No error seemed to occur either because I'm
not getting the output from my exception handler in the event logs...

Any ideas?

Dec 15 '05 #2
Thanks for the quick reply Nicholas! Yeah that helps me alot, I was
unsure of how to correctly do this. I wanted to make an app that sits
in System Tray to configure the service like many commercial apps do -
I always thought it was the same app as the service but now I realize
it's separate.

I will look up Remoting to see how that works.

Real quick though, remoting can work both ways right? The service can
also communitcate with this desktop app if it needs to.. can it?

thanks

Dec 15 '05 #3
tman,

Yes, it can. You can have an object sitting in your app which derives
from MarshalByRefObject, which you pass to your service. Then, when the
service calls a method on that object, it will marshal the call back into
your app.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"tman" <tl*****@gmail.com> wrote in message
news:11*********************@g44g2000cwa.googlegro ups.com...
Thanks for the quick reply Nicholas! Yeah that helps me alot, I was
unsure of how to correctly do this. I wanted to make an app that sits
in System Tray to configure the service like many commercial apps do -
I always thought it was the same app as the service but now I realize
it's separate.

I will look up Remoting to see how that works.

Real quick though, remoting can work both ways right? The service can
also communitcate with this desktop app if it needs to.. can it?

thanks

Dec 15 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Henry | last post: by
8 posts views Thread by Raed Sawalha | last post: by
3 posts views Thread by Kris van der Mast | last post: by
6 posts views Thread by Laser Lu | last post: by
3 posts views Thread by Simon Verona | last post: by
5 posts views Thread by Rory Becker | last post: by
21 posts views Thread by Dan Tallent | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.