473,385 Members | 1,396 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 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 7676
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Henry | last post by:
I was trying to work through the Lab 2 exercises in the Microsoft's Windows-Based Applications in Visual C#. While I am not showing any errors I am also not seeing the mainMenu object when I run...
8
by: Raed Sawalha | last post by:
I have form with progress bar ,when application begin processing and progress bar moving if I minimized the form and try to restore it ,it is not showing until the processing completed ,how can I...
3
by: Kris van der Mast | last post by:
Hi, I've created a little site for my sports club. In the root folder there are pages that are viewable by every anonymous user but at a certain subfolder my administration pages should be...
2
by: Chris Dunaway | last post by:
I am attempting to use the AppDomain.UnhandledException event in a Windows Forms app and also in a Windows Service. But the event doesn't seem to be called. In a Windows Forms app, the event IS...
6
by: Laser Lu | last post by:
Thanks for looking at this post:) Does anyone knows how to make the asp.net process runs in the UserInteractive mode? I just want to show some Windows Forms in my asp.net application on the...
3
by: Simon Verona | last post by:
I have a parent form which contains a toolbar. The toolbar controls the loading and switching to of MDI child forms. The code for the toolbar click event and one of the subroutines that loads...
1
by: Darsin | last post by:
What i am doing is to pull the data from a CMS and import it to Word 2007 Beta and i also have to export the data from Word 2007 Beta back to that CMS. We have with us two Web Services of the CMS....
5
by: Rory Becker | last post by:
Having now created a Custom MembershipProvider that seems to work correctly with my Logon and ChangePassword controls, I am, as they say, a happy bunny. The next stange is to move on to the...
21
by: Dan Tallent | last post by:
In my application I have a form (Customer) that I want to be able to open multiple copies at once. Within this form I have other forms that can be opened. Example: ZipCode. When the user enters...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.