Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

MessageBox from a Windows Service

Posted on 2004-09-13
2
Medium Priority
?
8,109 Views
Last Modified: 2008-02-01
I need to show a dialog box when something occurs during the execution of a windows service, but it's impossible using MessageBox.Show(string). I need to use ServiceNotification or DefaultDesktopOnly but I don't know how to do it...

Any solution?

Thanks!

Enric.
0
Comment
Question by:EM77
2 Comments
 
LVL 14

Expert Comment

by:AvonWyss
ID: 12043375
Well, in the Windows Service management console, you can check a box saying that the service shall be allowed to interact with the desktop. This may be what you are looking for. But remember that services are not supposed to display things on the desktop to begin with (and that'y why the interact option is off by default)...
0
 
LVL 10

Accepted Solution

by:
123654789987 earned 200 total points
ID: 12051630
I found it!

I put the following code in the service OnStart event and I got a messageBox

System.Windows.Forms.MessageBox.Show("Service started on:","",System.Windows.Forms.MessageBoxButtons.YesNo,System.Windows.Forms.MessageBoxIcon.Question,System.Windows.Forms.MessageBoxDefaultButton.Button1, System.Windows.Forms.MessageBoxOptions.ServiceNotification);
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…

972 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question