LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

preventing RT exception catch and modal popup

I have a CVI 8.0.1 application that generates run time exceptions (GPF's).

I'm in the release mode.

We run the CVI app from a WinXP command shell script, unattended.

I want the exceptions to propogate out of the CVI RT to the calling environment  (where we'll catch them as we're using C++ and invoke the CVI app from within a try block) but the CVI runtime is catching these and does a modal popup which hangs everything up.

How do I prevent the CVI runtime from doing this?    Earlier versions of CVI didn't do this as I recall.

Menchar
0 Kudos
Message 1 of 6
(4,751 Views)
To kindof answer my own question -

You can set a registry key ErrorMode to "2" to supposedly prevent modal popups from the OS and from any application.

HKLM\SYSTEM\CurrentCntrolSet\Control\Windows\ErrorMode

We found that this seems to work on Win2K, and WinXP SP1, but not WinXP SP2, curiously enough.

Still,  I should to be able to directly defeat the exception catch by the RT.    I'd like to know what good the catch does - all you could conceivably do is fire up a kernel mode debugger, but what good is that? 

Menchar




0 Kudos
Message 2 of 6
(4,713 Views)
Howdy menchar,
 
If the exception isn't handed by your LabWIndows/CVI executable, then the Windows OS should handle those exceptions. Of course, you need to know which type of exception might be thrown because you specify this in your catch statement.  Are you calling this executable from .NET or C++ 6.0? Could you post example code that I could run that demonstrates the behavior? What older versions of LabWindows/CVI did the behavior you expect occur in?
 
Best Regards,
Jonathan N.
National Instruments
0 Kudos
Message 3 of 6
(4,643 Views)

Jonothan -

I've written a command line utility in C using CVI 8.0.1 and we call it from a script that uses a C++ try /except block to catch any exceptions coming up off the CVI utility.

The utility is parsing a bunch of Word docs and soem binary file sets, was quickly put together, and occasionally tries to dereference an null pointer apparently when it encounters a malformed file set.  Since it's nearly impossible to code to anticipate all of the goofy ways the file sets might be malformed, we just let it fault and try to catch the exception from the calling code.

BUT, when the exception occurs, we get a modal popup that has a CVI "RT" logo in the upper right hand corner, apparently the exception is being caught by the CVI RT?   The popup hangs up the script, which is running unattended - there's no one there to click the close button on the modal popup.  I don't think the CVI RT did this before - exceptions would get propogated back to the Windows environment and Windows would do the popup.

I would not expect this to happen.  If the exception were allowed to propogate through the RT to the outer environment we would be able to catch it and handle it. 

The best we can do now is set the Windows errormode to "2" in the registry to try and prevent any modal error popups from Windows or from an application.  This seems to work on Win2K and WinXP SP1 but not WinXP SP2 for some reason.

Thanks,

Menchar

 

0 Kudos
Message 4 of 6
(4,634 Views)
Hi menchar,
 
Is it possible that you could post a screenshot of that exception dialog with our logo? Also, could you possible post some snippets of code to replicate the issue. I am causing general protection faults but the Windows OS errors pop-up and not the specific one you mention.
 
Best Regards,
Jonathan N.
National Instruments
0 Kudos
Message 5 of 6
(4,620 Views)

Jonathan -

Turns out this was a .NET thing - fellow worker had the .net development environment installed, and the development environmetn was what was catching the exception and doing the popup, not the CVI RT.  What fooled us was the presence of the CVI rt icon, but then this is probably embedded in a dll and the exception handler was able to find and display it in the modal popup.

So we turned off the exception catching in the .net development environment and now the exceptions propogate up the call stack as we wanted, with no modal popups since we have the windows error mode set to "2".

Thanks for the support Jonothan.

Menchar

0 Kudos
Message 6 of 6
(4,574 Views)