LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

error upon exiting program

analog wrote:

> Hi,
> With some help, I have narrowed down my problem to a simple block of
> code. I get the error message after I use this dll. But it only
> crashes in the *.exe file for some reason. So does that mean that
> there is a problem with the dll or is it the runtime engine that's got
> a problem?

From all the information I got from different places (other thread here
and Info-LabVIEW postings) I think the problem is that you quit your
application by basically aborting it before the Automation refnum to
your external Active X component is properly closed.
Since the component is not closed when the calling process terminates,
Windows disposes of any resources still open from that process and by
doing so cause
s your Active X component to somehow crash when Windows
calls it's unload function.
What you need to do is add a application specific exit button or file
menu item to your application on which occurrence you FIRST dispose of
any and all references to external resources (files, Active X objects,
network refnums, etc.) before actually executing the LabVIEW Quit function.
Either disable the X in the right top corner or add an Event case for
the Application.Exit event, and wire true to the dispose event param and
jump to your normal exit event handler where you dispose of all
resources properly.

The problem doesn't occur in the development environment since the
LabVIEW.exe process remains active and Windows does not try to dispose
the Active X DLL just yet. If you then would Exit LabVIEW itself it
would most probably crash too.

Rolf Kalbermatter
Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 11 of 12
(516 Views)
I waited til the application has finished running already, and then close it. Before my application is done executing, I already close all the references and everything inside my code. So when it's done running, shouldn't it be ok for me to close everything by hitting the X since every references are already closed?
0 Kudos
Message 12 of 12
(516 Views)