LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

ActiveX Control GPFs on Panel Discard

I have a DLL that contains the complete GUI and guts of my main panel. When the DLL detaches, the DLL calls DiscardPanel on the main panel.

I'm using the Microsoft's Rich Text Box v6.0 SP4 control in my CVI 7.1 app, and the control was built using CVI's ActiveX wizard.

Here's the problem: Whenever I call the DiscardPanel method, I get a GPF. I am 100% certain has something to do with the RTF control.

Do I need to discard the control in some way before I discard my panel? If so, how?
0 Kudos
Message 1 of 5
(4,423 Views)
Hi IBNobody,
 
Are you calling CA_DiscardObjHandle(..) before you discard the panel?  This will discard the ActiveX control panel handle. 
 
For an example, please see Help >> Example Finder >> Communicating with External Applications >> ActiveX >> General >> 3DGraph.prj.
Cheers,

David Goldberg
National Instruments
Software R&D
0 Kudos
Message 2 of 5
(4,396 Views)
Hi Nobody,
 
I was able to reproduce the GPF in the attached sample app. Thanks for reporting this bug.
 
In my sample app, I was able to work around the problem by discarding the control before getting to the DLL_PROCESS_DETACH. If you either discard the panel or the RTF control before getting to the DLL_PROCESS_DETACH, it will not crash.
 
Hope this helps,
 
- jared
0 Kudos
Message 3 of 5
(4,388 Views)
Jared & David,

I bit the bullet and implemented Jared's solution. I had to make changes to the base code and the DLL code, but the result will be cleaner. than just trying to discard the RTF control.

Rule of thumb: Don't discard on a DLL Detach.

Thank you both.
0 Kudos
Message 4 of 5
(4,364 Views)

Yeah, after looking at this a little bit, I realized that it wasn't really a bug. When you use an activex control, CVI uses other dlls, so in the process detach event, we can't rely on those other dlls still being around.

However, I noticed that CVI generates the call to DiscardPanel when CVI generates code for a dll that displays a UI. So we changed the generated code to not call DiscardPanel in the process detach.

- jared

0 Kudos
Message 5 of 5
(4,350 Views)