Hi,
I don't know how it is done in C++, but in asssembler, a (windows) dll has a
DllEntry Proc. C++ shoud not be too different.
If the dll is loaded, this proc is called, with reason= DLL_PROCESS_ATTACH.
If the dll is removed from memory, DLL_PROCESS_DETACH is the reason.
If the DllEntry proc is called with reason= DLL_PROCESS_DETACH (when the dll
is removed, e.g. when labview is closed, or all the dll references are
removed from memory), a proper cleanup can be made.
Of cource, this does require keeping track of all things to clean up (memory
created by the dll, etc.).
This is kinda fun, because you can make popups when a dll is loaded. The vi
does not even need to be started. Or you can make the popup appear when the
user is done with the dll, even if no vi is running.
Btw. In LV6, you can capture the 'close' event, and close everything
properly. You can choose to close the window, or to ignore the close.
Btw2. You can remove the menu (or just the exit), so the user is not able to
close LV.
Regards,
Wiebe.
"Tobe"
wrote in message
news:5065000000080000006E5A0000-1027480788000@exchange.ni.com...
> Hello!
>
> I'm about to finish my LabView application. I have some problems left
> and I need help to solve them.
>
> My porgram uses some C++ code (which I call from the "Call Library
> Function Node"). In LabView I've made a sequence where in the first
> frame all C++ init code is executed, the second frame is the main
> program and the last frame is the exit and clean up code. The clean up
> code must execute or there will be ports open, memory leaks, etc. My
> problem is that if you stop the program from the LabView menu stop
> button, the program terminates before the last frame is executed. I
> would like to either remove the LabView stop button or, connect the
> stop button to my exit code somehow.
>
> Follow up question: If I make an .exe (which is possible right?) are
> the stop start, stop, debug, etc -buttons still there? Or can you make
> a "real" application that don't use the LabView buttons to start,
> stop, etc?
>
> Thanks in advance,
>
> /Thomas