LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Problems with DLL_PROCESS_DETACH

Hy
This is the problem
I am using a dll wrote in LabWindows/CVI with a VC++.NET application. The dll has some Panels . On one of the interface functions the dll displays the Panel and runs the user Interface function (RunUserInterface) .  The QuitUserInterface is called on the close panel CVICALLBACK function. While the RunUserInterface is active I am closing the VC++ application but dll doesn't detach.
My solution was :
On the dll interface I made a function which calls the QuitUserInteface
 
Do somebody else has any suggestion?
 
Thanks
0 Kudos
Message 1 of 4
(3,329 Views)
Hello RaduBogdan,
 
The appropriate way to exit the RunUserInterface function is to call QuitUserInterface.  If you're not closing your application without pressing the Close button, and thus without calling QuitUserInterface, I'm assuming you are closing the application by pressing the Red X button at the top right corner.  You should create a panel callback that handles the EVENT_CLOSE event that is thrown when you press this button. 
 
int CVICALLBACK panelCB (int panel, int event, void *callbackData,
        int eventData1, int eventData2)
{
    if (event == EVENT_CLOSE)
        QuitUserInterface (0);
    return 0;
}
 
Then you're guaranteed to call QuitUserInterface in both scenarios.
 
Thanks.
Wendy L
LabWindows/CVI Developer Newsletter
0 Kudos
Message 2 of 4
(3,314 Views)
I'm sorry if i wasn't so clearly in my exprimation but the panel has a close event handler where it calls QuitUserInterface like you showed me and I am not closing the dll panel , I am closing the MFC Aplication.
0 Kudos
Message 3 of 4
(3,306 Views)
Hello RaduBogdan,
 
You need to make sure QuitUserInterface is called before you close the MFC application.  You can do this by making a function in your CVI DLL that calls QuitUserInterface (as you already did), then expose that function, or you can directly export the callback associated with the Quit button on your CVI user interface.  Then, as you have already done, you can call this function in your C++ code where it renders your MFC application and handles the IDCANCEL event.
 
Thanks.
Wendy L
LabWindows/CVI Developer Newsletter
0 Kudos
Message 4 of 4
(3,269 Views)