473,385 Members | 1,655 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.

Is there a way to open a windows form from a windows service?

I am monitoring certain events with a windows service
(derived from System.ServiceProcess.ServiceBase).
When a significant event comes up, I'd like to notify
the user with a pop-up dialog box or window.

In my event handler, I create a new thread, inside
which, I have:

MyForm frm = new MyForm();
System.Windows.Forms.Application.Run( frm );

I am able to step into the form initialization and load code,
but I never see the form on the screen. I also don't get
any errors.

What am I doing wrong?

Jul 21 '05 #1
2 1568
As far as I've understood it, windows services doesn't have a GUI at all.
I've had the same ideas as you have and in my search, I came across this
article describing how you can have an icon in the system tray (next to the
clock) as your main user interface for a win-forms application.

Check it out and see if it's anything you can use. (The example is in
VB.NET, but is easily converted into C#)

http://www.devcity.net/net/article.a...vicecontroller

"Alexander Feygin" <Al*************@discussions.microsoft.com> skrev i
meddelandet news:46**********************************@microsof t.com...
I am monitoring certain events with a windows service
(derived from System.ServiceProcess.ServiceBase).
When a significant event comes up, I'd like to notify
the user with a pop-up dialog box or window.

In my event handler, I create a new thread, inside
which, I have:

MyForm frm = new MyForm();
System.Windows.Forms.Application.Run( frm );

I am able to step into the form initialization and load code,
but I never see the form on the screen. I also don't get
any errors.

What am I doing wrong?

Jul 21 '05 #2
Alexander Feygin wrote:
I am monitoring certain events with a windows service
(derived from System.ServiceProcess.ServiceBase).
When a significant event comes up, I'd like to notify
the user with a pop-up dialog box or window.

In my event handler, I create a new thread, inside
which, I have:

MyForm frm = new MyForm();
System.Windows.Forms.Application.Run( frm );

I am able to step into the form initialization and load code,
but I never see the form on the screen. I also don't get
any errors.

What am I doing wrong?


See the thread that mentions WS 2.0

You're looking for your service to act as a push server to a client (
the popup ).

Jul 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: WJ | last post by:
My system is an XP Pro. with the lattest patches & Service pack applied. 1. I have IIS installed with XP first. 2. I have .NetFW 1.1 installed next via Windows Update. 3. I have VS.Net 2003 EA...
3
by: Stephen | last post by:
I'm experiencing a strange problem that has me baffled. I created a webservice with a webmethod that connects to a remote MS SQL Server. It works fine when connecting to one server (running SQL...
1
by: Scott Davies | last post by:
Hi, I'm looking for some help on a small program that I'm trying to develop in VB.NET. I'm having trouble getting the code that I've written to work, can anyone shed some light as to where I'm...
0
by: Scott Davies | last post by:
Hi, I'm looking for some help on a small program that I'm trying to develop in VB.NET. The program I'm trying to develop needs to be able to do the following: - Select remote server -...
3
by: Rob | last post by:
Can a form be opened from a Windows service? I have a windows service that I would like to open a form from a notify icon. I cannot get the Notify Icon to display nor can I open a form. Any...
2
by: Alexander Feygin | last post by:
I am monitoring certain events with a windows service (derived from System.ServiceProcess.ServiceBase). When a significant event comes up, I'd like to notify the user with a pop-up dialog box or...
4
by: tshad | last post by:
What would be a good way to check programmatically whether a service was running? We have a service that dies periodically and I need to check to see if this service is running. I know how to...
22
by: robertgregson | last post by:
Using C#, .NET3.5, Visual Studio 2008 and WCF on Windows VISTA SP1, I have written a service, service host (as a C# console application) and a client. The service uses...
5
by: Stefano Tonello | last post by:
Hi all, I need to call windows' "open with" dialog from my C# windows form application. After the user selects application, control must return to me (I have to launch directly the process). I...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.