Exception not being catched

M

Me

Hi,

I have just finished a VC.NET program. This program is running fine when i
run it within the "ide" but when i run it without the "ide" my exceptions
are not being catched. It is to say the last one i throw. Let me explain
what i meen:

this is my form1.cpp(main form) file :

int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR
lpCmdLine, int nCmdShow)
{
System::Threading::Thread::CurrentThread->ApartmentState =
System::Threading::ApartmentState::STA;
try
{
Application::Run(new frmMain());
}
catch (System::DllNotFoundException * error)
{
error = NULL;
Application::Exit();
return 1;
}
catch (System::Exception * error)
{
error = NULL;
System::Windows::Forms::MessageBox::Show("Het programma is gestopt omdat er
zich een onbehandlde fout heef voorgedaan");
Application::Exit();
return 2;
}
catch (...)
{
Application::Exit();
return 3;
}
return 0;
}

In the mainform headerfile when a specific condition is not met i throw a
dllnotfoundexception. this is becauce my application has to exit then (it
can not continue)
Like i said this works fine from within .net ide (so i'm convinced it is not
my coding) but without the ide i get a box telling me there has been a
unhandled exception, and asking me wheter i want to continue or exit the
program. And it gives also some information about jit debugging. Can
somebody help me on how to disable this message from appering and just let
my program exiting. (Application::Exit() on the place where i throw the
exception does not work)
 
S

Sean Chapman

its possible that Application.Exit() is throwing an exception... so u cant
catch it... that is an interesting prob.
 

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