NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Calling a CVI dll

Hi,

 

I am starting working my way through UsingLabVIEWLabWindowsCVIwithTestStand.pdf  but I was wondering if anyone else has over come the following?

 

I have TestStand 2010 SP1 calling a CVI 2010 dll but all is not working as expected.

 

Within the dll there is a table, which fills from an ini file, this works along with the search and sort functions of the table.

 

Also there is a quit button, which is not working with TestStand giving an error.

 

The CVI code works as an executable.

 

Until I work my way through the above document I will restrict my question to how do I get the quit to work correctly i.e. exiting the CVI code and returning to TestStand and not get an error?

 

Thanks for you help

Simon

0 Kudos
Message 1 of 7
(3,479 Views)

Hi Simon,

 

One thing to check is to use the LoadPanelEx function (rather than LoadPanel) to load your UIR.  This function is basically the same as LoadPanel, but allows you to specify your dll as the caller (using the __CVIUserHInst constant for the last parameter).  See the LoadPanelEx help topic for details on why this is recommended when using a UIR in a dll.

 

I am thinking that using this function will allow your DLL to find the callback associated with your quit button.  If you are still having trouble, please reply with a bit more info:

 

  1. What error are you seeing exactly?  When does it Occur?
  2. What code is being called in your quit button callback?

Keep me posted!

Al B.
Staff Software Engineer - TestStand
CTA/CLD
0 Kudos
Message 2 of 7
(3,434 Views)

Al B.,

 

Thanks,  I will look into it.

 

I have been side tracked so it will be a few days.

 

For sure I will keep you informed.

 

Not sure is my question is too much, as I know so little or my approach is totally wrong but it is taking me time to try to sort out how best to build a CVI dll with and without UIR's that will pas information to and from TestStand.

 

Thanks for the help

Simon

0 Kudos
Message 3 of 7
(3,426 Views)

Hi,

 

When TestStand calls the UIR in CVI it will only hold open the UIR itself because I have a delay in the code. When I hit the Quit button the UIR will close but the CVI code is still executing the delay as it is not till this delay is over will the next step in the TestStand execute, displaying a calculated value got from the CVI code.

 

With out the delay in the CVI code it will flash through the CVI code, giving the expected calculated value out as this value is displayed in the next step in TestStand.

 

I need the UIR to remain open till the Quit button is pressed.

 

How is this best done?

 

Thanks

Simon

0 Kudos
Message 4 of 7
(3,398 Views)

Hi Simon,

 

Make sure you are calling the quitUserInterface function in your quit callback - this will cause the RunUserInterface() in your main function to finish executing, allowing your program to complete.  You may want to look at the User Interface application template in CVI for an implementation of this, which you can access through file»new»Project from template..

 

If you are still having problems with the dll not returning correctly, please attach the source code so I can take a closer look.

Al B.
Staff Software Engineer - TestStand
CTA/CLD
0 Kudos
Message 5 of 7
(3,392 Views)

Hi,


I am doing all this with TestStand as the starting point. It is from here I
have used the “Create Code” button and then trying to put my code into the
construct it provides. 

I believe I have now got a loop with a boolean condition, tell me if I am
wrong, as I say I am only learning, even something this basic. Thanks to the UK Support folk for this. 

do

                {
                                ProcessSystemEvents ();
                                strcpy ((char*)arg3, CelValue); //will hand back to TestStand the selected value from the table                               

                } while (Exit!= 1); 

Up to this point Exit is set to 0, I will load the panel, fill the table with the information from the ini file, then enter the Do/While.

All the functionally of the table appear to work, I can copy the select table
value to a text box, etc.

I believe this is good.

I hope this will be a good basis to build code like this in the future.

 

I attach the code, DisplayAdditionResult.c, just in case this may not be the best way to go forward.

Thanks for the help and direction
Simon

0 Kudos
Message 6 of 7
(3,381 Views)

Hi Simon,

 

The method you use looks like it will work - I would however recommend a small delay in your do loop so that other threads and processes will be able to run.  

Al B.
Staff Software Engineer - TestStand
CTA/CLD
0 Kudos
Message 7 of 7
(3,364 Views)