NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Error in call to LoadPanel

When I run my app at the target, I get an error (show stopper) that says (more or less)

Error in call to LoadPanel. Tsc_Setup_uir.uir, Panel Resource ID: 2, Error Code: -86. Callback function QuitLoginInstCB not known.

Background: I'm using LabWindows/CVI 7.1 and TestStand 3.1. I created a file called TSC_DLL_Export.h that contains all the routines called by my specifyModule(s) for each step in the TestStand Sequence. That .h file has a checkmark next to it in the CVI Build::Target Settings, Exports - Export What: Include File Symbols (click the Change button). Since I started seeing this error, I've tried adding to TSC_DLL_Export.h the callback in question, along with the other callback functions I noticed when I look at some of the buttons inside the Tsc_Setup_uir.uir file. I've also tried a variation where the TSC_DLL_Export.h contains just the Specify Module routines and in the Export What: Include File Symbols, I also checkmark the .h file for the uir file.

The .uir is listed in the TestStand workspace file and it's getting placed in the installation directory at the target, along with the other .UIR files, TestExec.exe, etc. I have other UIRs that have panels that get displayed just fine, but I don't think any of those have callbacks associated with them.

When I do a build, it's for a Release - Dynamically Linked Library. Any ideas?
0 Kudos
Message 1 of 5
(7,038 Views)
Hi mrbean,

You are seeing that error because you have the function QuitLoginInstCB in you UIR( in your panel) but not in you dll as a function to call.

Regards
Ray Farmer
Regards
Ray Farmer
0 Kudos
Message 2 of 5
(7,032 Views)
Actually, the file containing the function IS in my DLL (I do build a DLL, not an executable). Just to verify, within TestStand, when I open up the associated sequence, and select one of the tests, and right-click to specify module, my DLL is shown in the module path name. And, when I click on the drop down for the available Function Names, QuitLoginInstCB is shown.

I did notice, however, on p. 4-6 of the course manual entitled, "LabWindows/CVI Basics II", it talks about exporting modules from the DLL, and that to do this, you must have a header file containing the prototypes of the functions you want to export from the DLL. This file must be added to the CVI project. Then, in the Target Settings dialog box, you can select this file from the list of all header files.

Through trial and error, I discovered that at a minimum I needed (in the export header file) the prototypes of all the functions I call from my Specify Module declarations. In this .h, I also include the QuitLoginInstCB prototype, but it doesn't seem to help.

I'm wondering about the importance of the .lib file. It gets created at the same time as the DLL. The DLL is referenced in the TestStand workspace file, but the .lib I don't include in the CVI project, and it's not mentioned in TestStand (workspace, deployment).

Help
0 Kudos
Message 3 of 5
(7,030 Views)
hi mrbean,

You probable should be using should be using the LoadPanelEx function rather than the LoadPanel. Read the help for the LoadPanelEx for explanation.

If it a panel callback its going to look like:

int CVICALLBACK PanelCB (int panel, int event, void *callbackData,
int eventData1, int eventData2)

If it is a control callback its going to look like:

int CVICALLBACK ControlCB (int panel, int control, int event,
void *callbackData, int eventData1, int eventData2)

Not sure what QuitLoginInstCB is a callback for.

But if you have exported it, an you are calling it from TestStand via the DLL adapter, then I dont see how your callback can work. Surely you will want a function that you call from TestStand which when loaded will run and load your panel, diaplay it, and Run the User Interface. Then Your Callback QuitLoginInstCB will come in to play when you press the required control.

For instance
TestStand step calls QuitLoginInst()

When the user panel is displayed and the User Interface is running.

User Presses the QuitLoginInst control which calls the QuitLoginInstCB(), this perform removing of the panel and QuitUserInterface() and thus allows QuitLoginInst() to complete and return to TestStand.


Here is a typical example of displaying a modal panel from TestStand (its uses TestStand Ver2.0 prototypes)


This is the function that will be called from TestStand
void __declspec(dllexport) TX_TEST DisplayModalDialog(tTestData *testData, tTestError *testError)
{
// Getting the Engine object from the Seq Context
TS_SeqContextGetProperty (testData->seqContextCVI, &errorInfo,
TS_SeqContextEngine, CAVT_OBJHANDLE,
&engine);
// Loading the interface panel into memory
panelHandle = LoadPanelEx (0, "ModalDialog.uir", PANEL, __CVIUserHInst);

// TS_StartModalDialog function causes the dialog box to be modal
// with respect to the application that created the TestStand
// Engine object you specify (i.e. Seq Editor or Oper Interface)
TS_StartModalDialog (engine, &errorInfo, &modalData);

// Displays and activates a panel as a modal dialog box.
InstallPopup(panelHandle);

// RunUserInterface() runs the User Interface and issues events to
// callback functions.
RunUserInterface();


Error:

// If an error occurred, set the error flag to cause a run-time error in TestStand.
if (error < 0)
{

testError->errorFlag = TRUE;
CA_DiscardObjHandle(engine);


}

return;
}

This is the Callback function that is assigned to the Quit button in the UIR
int CVICALLBACK Quit (int panel, int control, int event,
void *callbackData, int eventData1, int eventData2){

switch (event)
{
case EVENT_COMMIT:

// Removes either the active pop-up panel or all pop-up panels.
RemovePopup(panelHandle);

// Causes RunUserInterface() to return.
QuitUserInterface(0);

// Call this function after you discard or hide the dialog box
// panel
TS_EndModalDialog(&errorInfo, &modalData);

// Removes a panel and any of its child panels from memory and
// clears them from the screen if visible
DiscardPanel (panelHandle);

// This function releases resources associated with the object and
// calls the Release method of the Automation server object.
CA_DiscardObjHandle(engine);

break;
}
return 0;
}

Finally you dont need the LIB file on your target system, this is only required to build your EXE | DLL file.

You have dont need to have a H file. If in your CVI setting, in the Target Setting, if the 'Export What' control is set to 'Symbols Marked for Export', then you dont need an H file, but you probably will have a H file because you have an UIR file but you dont what to export the callback function within that H file as you would not be calling them direct from some external process. ( the example above comes from a project which has an include file for the UIR and the Target Settings are set for Symbols Marked for Export.)

Hope this helps
Regards
Ray Farmer
Regards
Ray Farmer
0 Kudos
Message 4 of 5
(7,028 Views)
Replacing LoadPanel with LoadPanelEx did the trick. Thank you very much
0 Kudos
Message 5 of 5
(7,020 Views)