Our online shopping is experiencing intermittent service disruptions.

Support teams are actively working on the resolution.

Example Code

Creating a CVI DLL That Contains an UIR File, And Use The DLL in Visual C++

Code and Documents

Attachment

Download All
There are two .zip files in this example program. CVI.zip contains the workspace (testCVI.cws) and files necessary to create the DLL in CVI. This DLL exposes a function that loads a CVI panel. VC++.zip contains the workspace (testDLL.dsw) and files necessary to create a MFC project that calls the CVI DLL created in testCVI.prj. When you run the program in the VC++.zip file, you'll see an "Open Panel" button. When you click the "Open Panel" button, it loads and displays the CVI panel through the CVI DLL called testCVI.dll. Click the "Quit" button on the CVI panel and then click the "Cancel" button on the MFC dialog in order to close the program.

In CVI projects, note that the cvi\include and cvi\sdk\include directories are explicitly specified in the include path. To check these directories, go to Options»Include Paths in the project window. Also, note that in the testCVI.c file you need to call LoadPanelEx function, not LoadPanel function. LoadPanelEx is similar to LoadPanel, except that the callback functions you reference in your .uir file can be defined in the DLL that contains the call to LoadPanelEx. LoadPanelEx function has an additional parameter, callingModuleHandle, where you can use the default parameter, __CVIUserHInst, to specify the handle of the module that contains the call to LoadPanelEx.

In Visual C++ projects, note that you need the .lib, .dll, .h, and .uir files for the DLL you created in CVI. Note that you do not need to include .obj for the callback table in your Visual C++ project.

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Contributors