Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 8272
  • Last Modified:

MessageBox from a Windows Service

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
EM77
Asked:
EM77
1 Solution
 
AvonWyssCommented:
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
 
123654789987Commented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now