Re: Prevent Window Popup



You said "The ErrorMode setting will not intercept all messagebox calls
if that is what you are thinking." Yes this is what I was thinking.

I am also aware of the differences between services and applications. The
demo was just something quick and dirty to try.

The code is not mine and I am debugging in the dark. Trying to find any
information that I can pass on to help fix the issue.

Appreciate the help.

Dave


"TP" wrote:

Hi Dave,

Did you write the code for the service that is having the
problem? If yes then it is best to troubleshoot the cause(s)
of why the service is crashing and/or refusing to shutdown
gracefully.

The ErrorMode setting will not intercept all messagebox calls
if that is what you are thinking.

For a service there should not be any user-interface related
code such as forms, messagebox.show, etc.

I don't think your test code approximates the scenario. Did
you run it as a service? I think that using pinvoke to call
the MessageBox function with MB_SERVICE_NOTIFICATION
for the uType parameter *may* be closer, however, I have not
tested it.

Also keep in mind that code that you run under Vista Business
as a normal application will not run in session 0 (like a service
or app running on the console of 2003 would) and it will not be
running under the SYSTEM account.

-TP

Webbert wrote:
Gave it shot on my machine "Vista Business" using the code as a test

using System;
using System.Windows.Forms;

namespace CreateException
{
. class Program
. {
. static void Main( string[] args )
. {
. MessageBox.Show( "Some text", "Error Caption",
MessageBoxButtons.OK, MessageBoxIcon.Hand );
. throw new ApplicationException( "This is just a test" );
. }
. }
}

With ErrorMode=2 and then with NoInteractiveServices=1, this produce
no noticable results.
Both the popup and error message was still seen. May be a "Vista"
thing though.

I will try it on a server once I get a virtual up and running.

Thanks for the suggestion.

Dave

.