Christian Hackl
2010-03-12 15:13:39 UTC
Hi everyone,
I do not want the Abort/Retry/Ignore dialog to be opened by abort() on
assertions in a Win32 GUI application. Let's say I have this piece of code:
#include <windows.h>
#include <cassert>
extern "C" int WINAPI WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
assert(false);
}
And I compile and run it like this:
cl /nologo main.cpp
main.exe
What I want now is to have just the usual "An unhandled Win32 exception
ecc." error message box with an OK button and immediate program
termination afterwards.
I've read the documentation on abort() at MSDN [1], but what is
explained there is not at all what happens on my machine.
First, it says:
| When the application is linked with a debug version of the run-time
| libraries, abort creates a message box with three buttons: Abort,
| Retry, and Ignore.
On my computer it appears even with the release versions of the run-time
libraries.
Then it says:
| If the user clicks Ignore, abort continues with its normal execution:
| creating the message box with the OK button.
If I click Ignore, there's no message box. The application just
continues instead of terminating, which is exactly what I want to forbid
in case of an assertion...
[1] http://msdn.microsoft.com/en-us/library/k089yyh0(VS.80).aspx
I do not want the Abort/Retry/Ignore dialog to be opened by abort() on
assertions in a Win32 GUI application. Let's say I have this piece of code:
#include <windows.h>
#include <cassert>
extern "C" int WINAPI WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
assert(false);
}
And I compile and run it like this:
cl /nologo main.cpp
main.exe
What I want now is to have just the usual "An unhandled Win32 exception
ecc." error message box with an OK button and immediate program
termination afterwards.
I've read the documentation on abort() at MSDN [1], but what is
explained there is not at all what happens on my machine.
First, it says:
| When the application is linked with a debug version of the run-time
| libraries, abort creates a message box with three buttons: Abort,
| Retry, and Ignore.
On my computer it appears even with the release versions of the run-time
libraries.
Then it says:
| If the user clicks Ignore, abort continues with its normal execution:
| creating the message box with the OK button.
If I click Ignore, there's no message box. The application just
continues instead of terminating, which is exactly what I want to forbid
in case of an assertion...
[1] http://msdn.microsoft.com/en-us/library/k089yyh0(VS.80).aspx
--
Christian Hackl
***@sbox.tugraz.at
Milano 2008/2009 -- L'Italia chiamò, sì!
Christian Hackl
***@sbox.tugraz.at
Milano 2008/2009 -- L'Italia chiamò, sì!