vc++ service needs to suppress application error dialog

G

Guest

I have written an application that runs as a subprocess of a service, where the service is a .NET C# Windows Service that simply starts the subprocess and then periodically checks that the subprocess is still running, restarting it if it have stopped.

The problem is that the application is occasionally crashing, and when it crashes it gets hung up waiting on an Application Errror dialog.

How, from the c++ code of the application, do I ensure that any and all errors never cause a dialog to be displayed, and wait for user input? This really is a service that must run unattended. If the application crashes, I just want it to terminate and let the wrapper service notice the crash and restart the application.

Thank you very much for your prompt assistance with this.

-M
 
N

Nishant S

Try this :-

SetErrorMode(SetErrorMode(SEM_NOGPFAULTERRORBOX) | SEM_NOGPFAULTERRORBOX);

There is no GetErrorMode, which is why the seemingly redundant call to
SetErrorMode twice :)

--
Regards,
Nish [VC++ MVP]
http://www.voidnish.com /* MVP tips tricks and essays web site */
http://blog.voidnish.com /* My blog on C++/CLI, MFC, Whidbey, CLR... */


m11533 said:
I have written an application that runs as a subprocess of a service,
where the service is a .NET C# Windows Service that simply starts the
subprocess and then periodically checks that the subprocess is still
running, restarting it if it have stopped.
The problem is that the application is occasionally crashing, and when it
crashes it gets hung up waiting on an Application Errror dialog.
How, from the c++ code of the application, do I ensure that any and all
errors never cause a dialog to be displayed, and wait for user input? This
really is a service that must run unattended. If the application crashes, I
just want it to terminate and let the wrapper service notice the crash and
restart the application.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top