LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

'DisplayPanel' fails via DLL?

Hi-
 
I've created a DLL using LW/CVI 7.1 containing many interfaces, one of which opens a .UIR GUI for manually controlling an instrument for use in an ADA (uggh) application.  All of the CVI DLL interfaces work ok from the ADA program except the one that runs the GUI.   When 'DisplayPanel' is called, I see the my panel with its proper title (but no controls) briefly appear, and then it quickly disappears.  A Constraint_error is raised in my ADA app, but it occurs before I can collect any CVI status info from the call to 'DisplayPanel'.
 
As a test I created a separate CVI application that only makes calls into the DLL.  It runs all DLL interfaces including the GUI perfectly.
 
I'm pretty stuck here ...  Any ideas!?   Any thoughts on a troubleshooting approach would also be appreciated.
 
Thanks!
 
-Twitch
0 Kudos
Message 1 of 6
(3,212 Views)

Don't you be knocking my ada. Smiley Very Happy

Can you run the ada in debug and trap the error any better?  Constraint errors are most commonly caused by array out of bounds.  C will let this happen.  Ada catches it.  That would be my first area to check.

You could also put in an exception handling block in your ada so that it does not bomb off.  My guess is that you would then see your panel with controls drawn up until the point of exception (like seeing 3 out of 9 controls or whatever).

Message Edited by scomack on 04-25-2007 03:07 PM

Message Edited by scomack on 04-25-2007 03:07 PM

0 Kudos
Message 2 of 6
(3,209 Views)

Ok, sorry "Ada is the best!"  "I love Ada!".  There, happy now ?!  Smiley Tongue

I have an Ada constraint error trap wrapping the call into the DLL.  I use the Ada debugger to single-step this call.  The routine in the DLL simply loads and displays my .UIR panel, then starts the user interface.  I put statements in the DLL to write to a DOS window between each of these steps, so I can see where the error occurs.  The DLL runs the LoadPanel routine successfully but when the DisplayPanel procedure runs, program control is returned directly to the Ada with constraint error raised.  The CVI code never completes the call to DisplayPanel because I never see my subsequent debug statement print to the DOS window.  I see my .UIR panel frame flash and then disappear, thats it.

Is there any insight into how the DisplayPanel library routine runs?  How I might be voilating an array boundary here? 

Thanks for your help scomack, I appreciate your efforts.

-Twitch

 

 

0 Kudos
Message 3 of 6
(3,192 Views)
Hey Twitch,

This is a kind of a shot in the dark because I am not familiar with ADA, but in the CVI code are you using LoadPanel or LoadPanelEx.  If you are building your CVI code into a DLL, you need to make sure to use LoadPanelEx instead of LoadPanel. With LoadPanelEx it is possible to specify the calling module handle where CVI should look for panel callback functions.  The help for LoadPanelEx explains this in a little more detail as well.  Hope this helps!
Pat P.
Software Engineer
National Instruments
0 Kudos
Message 4 of 6
(3,178 Views)

Hi Patrick-

Yes, I'm using LoadPanelEx, thanks for contributing. 

I've actually made some progress here.  It turns out that if I use a .UIR file with "Classic" controls, I don't get the error.  If I use any of the newer style controls (ones that have 3-dimensional shading) I see the error.  I've found that this applies to GenericPopup message boxes also, where the command buttons are the new shaded type.  I need to replace them with my own interfaces using Classis command buttons to get it to work.

I'm in the process of reproducing my .UIR panels to use all classic controls and have so far been successful.  Its painful and tedious but at least I think I'll have something that will work.

If anyone has any insight into why this might be happening, I'd sure like to hear it!

-Twitch

0 Kudos
Message 5 of 6
(3,174 Views)
The run-time engine relies on mesa.dll (National Instruments\Shared\Mesa\mesa.dll) to render the 3D-shaded UI elements, whereas the "classic" UI elements are rendered completely by the run-time engine.  It's possible your problem is related to the (failed) loading of this DLL, but I couldn't speculate beyond that.

Mert A.
National Instruments

0 Kudos
Message 6 of 6
(3,168 Views)