From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

LabWindows/CVI Tips 'n Tricks

Having trouble finding your "Executable to Run After Setup" distribution kit option since upgrading to version 8.0 or later?  Not to worry -- it's still there, but just a little less visible. On the Files tab of the Edit Installer dialog, if you right-click a file in the installation browser, you will see a "<Filename> Options..." menu item which will bring up a dialog with options for that particular file.



You can also double-click the file or press Enter to access the dialog.



If the file is a runnable file, like an .exe or .bat file, the dialog will expose the option to run the file after installation and/or during uninstallation.  You can also provide command line arguments to pass to the file, which may include symbolic variables like %dest or %src (see the help for details) that are expanded into concrete values at run-time. 

The dialog exposes other options, such as installing the file as read-only, hidden, or system, or registering the file as an ActiveX server.  The path at the top of the dialog shows you where the file will be copied from when you build your distribution.  Double check this path if the browser displays your file in red, indicating that it can't be located at the expected path.

Mert A.
National Instruments

Message Edited by Mert A. on 08-31-2007 02:27 PM

Download All
Message 21 of 42
(19,254 Views)
Programmers sometimes like to add some standard documentation before each function definition. I'd like to highlight a couple of options in this area:

1. If you'd like your function documentation to be available from the prototype tooltip (see prototype.jpg, attached), there are a number of tags you can add immediately above your function. For an example of this, open samples\networkvariable\quality\nvquality.cws. Before most functions, you can see triple-slash (///) tags, such as HIFN and HIPAR. These tags tell the CVI compiler to include the corresponding documentation in the browse information. For example, after building that project, type "TypeToString (" and then hit <F1> to see the documentation.

If you search the CVI help for 'HIFN' you can see a description of the syntax of each tag.

2. If instead of using the HIFN and HIPAR tags, you'd like to have your own standard documentation -- something like this, for example:

//************************************************
// Function: <MyFunc>
// Description:
//
//
//
//************************************************

I would suggest recording a macro that you can use to insert this template with a single keystroke. I'm attaching here a macro that you can import into CVI (click Tools>>Source Code Macros>>Manage and then click Load to load the macro, and then double-click on the macro to assign it a shortcut key), and which creates this particular template.
Of course you'll probably want to create your own template, in which case you can record your own macro. You can do so from the Source Code Macros sub-menu (hint: in order to insert the appropriate function name in the comment block, you can select the function name while you're recording the macro, then copy it to the clipboard, and then paste it into the comment block).

Luis
Download All
Message 22 of 42
(19,221 Views)
Cvi doesn't integrate with windows very well. For example it does not use the windows taskbar when minimising windows.
This often means that cvi windows are lost under other windows and I often end up searching under a sea of windows.

To solve this I created a simple python script that creates an icon that sits in your system tray.
A right click on the icon lists all the opened cvi windows, select one to bring it to the foreground.

The workspace window is also always listed first and can also be brought to the foreground by double clicking the icon.

The following dependancies are required for the script.

http://www.python.org/ftp/python/2.5.1/python-2.5.1.msi
http://downloads.sourceforge.net/wxpython/wxPython2.8-win32-unicode-2.8.4.2-py25.exe
http://heanet.dl.sourceforge.net/sourceforge/pywin32/pywin32-210.win32-py2.5.exe

Also the path of the icon is assumed to be
iconpath = r"C:\Program Files\National Instruments\CVI80\cvi.ico"

Open the script in an editor and change this to where yours resides.

Script Attached.

Hope it helps people.

Glenn
Message 23 of 42
(18,767 Views)
CVI IDE is really where the developpers spent most of their time.
This is why it is so important to have they need at their finger tips
I heavily use the web and I use some sites as references
This is why I like this tips

Options/Tools Menu Options...
Click on the Add button on the dialog box

"Menu Item Name", type in the name you want to see in the Options menu
"Program Name", type in the name of the application you want to invoke (explorer.exe in our case)
"Command Line Arguments" type in the arguments list ("http://ni.com/cvi" for example)

Here is an example :


Now if you want to go one step further and invoke an help file from one of the Items of the Options menu you can follow the same procedure but
1 - Type in "C:\WINNT\hh.exe" as Program Name
2 - Type something like "C:\Program Files\MSSOAP\Documentation\soap3.chm" as Command Line Arguments



Message Edité par 40tude le 11-13-2007 12:28 AM
Regards, Philippe proud to be using LabWindows since version 1.2
// --------------------------------------------------------------------------------------------
Message 24 of 42
(18,073 Views)

Hello everyone,

This is a tip that has been mentioned in a few other threads, but I wanted to post it here too:

Declare Variables Anywhere in Your Code like C++/Java and other helpful ANSI 99 features

A subset of C 99 features have been implemented in LabWindows/CVI 8.5 (which SSP customers should have already received).  Even though a subset of the features in the ANSI 99 standard have been implement, CVI is not  fully C 99 compliant (which is also the case for many C/C++ development environments).  To learn more about available ANSI 99 features and how to enable them, read LuisG post on the following thread.

Some C 99-specific features include:

  • Declaring variables in the middle of a block
  • Macros with variable arguments.
  • Allocating memory on the stack (alloca call).
  • Support for the long long data type

Minimum Version: CVI 8.5

 

Happy coding!

Message 25 of 42
(17,959 Views)
Howto Add cursors to a strip chart.
 
Cursors on a strip chart can be very useful, but are not implemented in the strip chart control.  I use cursors on my strip charts to measure average real-time signal amplitude, offset, etc.  I also pause the plotting data to then measure time periods and frequencies without have to "chase" the data across the screen. 
 
You can add cursors by placing a Graph control on top of the plot area of the strip charts.  Turn off all of the labels, gridlines and borders on the graph and set the background color to transparent.  Now only the cursors on the chart are visible.  You will, of course, have to resize the graph every time you resize the chart to keep it exactly covering the PLOT_AREA of the strip chart. 
 
To read the cursors values from the strip chart (and not the graph), set the scale of all axes on the graph to min = 0,  max = 1.0, gain = 1.0.  The value of the strip chart at the cursor position for a vertical axis is then,
 
Stripchart_Axis_min+ (Stripchart_Axis_Max - Stripchart_Axis_min)*cursor_position_for_axis.
 
To get the cursor value of the scrolling x axis is a little different.  XAXIS_OFFEST + (POINTS_PER_SCREEN*cursor_position_for_axis)*XAXIS_GAIN.
 
I rarely display the absolute cursor position and therefore I don't add the XAXIS_OFFSET or have to worry about changing the cursors value as the data scrolls.  Usually the delta between cursors is most important in my applications and this mention of adding cursors works exactly as required. 
 
I update the cursors values in a label or number control either with a Timer, when I plot new data or (most often) only when the user moves them (EVENT_VAL_CHANGED).
 
Greg
 
 
 
 
 
 
 
Message 26 of 42
(17,362 Views)
Every now and then, CVI users report a crash in the CVI environment, or in a CVI program that can't be explained by what the program is doing. If this crash can't be reproduced reliably, it's usually very hard for us here at NI to investigate the root cause of it. When that happens, a useful thing to do is to generate a crash dump and attach it to your bug report. The thing to keep in mind is that you have to suspect that a crash might be coming at some undetermined time in the future and enable the Windows debugger for dump generation before the crash happens.
 
Here's how you can have Windows create a crash dump:
 
Windows XP
 
1. Run c:\windows\system32\drwtsn32.exe -i
(this will register Dr. Watson as your "just in time" debugger)
 
2. Whenever you get a crash and you see the "Please tell Microsoft about this problem..." dialog, click "Don't Send".
 
3. Browse to the C:\Documents and Settings\All Users\Application Data\Microsoft\Dr Watson folder. The dump and log files are there. Keep in mind that if you have a second crash, it should overwrite the previous dump.
 
Windows Vista
 
Dr. Watson is not available in Vista, and its replacement (Windows Error Reporting) is very flaky, when it comes to generating crash dumps. So your best bet is to use windbg.
 
1. Install the Windows debugging tools.
 
2. Run C:\Program Files\Debugging Tools for Windows\windbg.exe -I
(this will register windbg as your "just in time" debugger)
 
3. When you get a crash, windbg should start up automatically. At that point, in to its command window type .dump /ma c:\temp\mydump.dmp to generate the dump file.
 
Note that this is still not as useful as specific instructions for reproducing the crash, but if that isn't possible, then this is definitely worthwhile.
 
Luis
 
 
Message 27 of 42
(16,804 Views)
The colors used in the CVI source editor can be customized to your preference using the Options >> Colors menu item. CVI stores this customization in the HKCU\Software\National Instruments\CVI/[version]\ColorPreferences registry key - so if you want to share your customization or use the same colors on multiple machines, then you can do so by exporting and importing this key.
 
Nowadays, I prefer a dark color scheme, and so customized my CVI 8.5 installation. I am attaching my customization in case anyone wants to check it out. This may be a good thread in which to share other interesting colorschemes for the CVI source editor.
0 Kudos
Message 28 of 42
(16,723 Views)
If you are using system colors in the CVI source editor, you must turn it off before customizing the colors manually or by importing reg scripts. You can turn this off in the Options >> Colors dialog. Also, if you turned off 'Syntax Coloring' in the Options menu you should turn this on before customizing. If you are customizing by importing the reg file, then you should make these changes in CVI, exit CVI, run the reg file, and then restart CVI. I am attaching another reg file that makes these changes in addition to customizing the colors - you still need to make sure CVI is not running when you import this reg file.
0 Kudos
Message 29 of 42
(16,693 Views)
Nomore do you have to carry the uir file side by side with the executable!
 
You can embed it directly into your executable and use just a single file to distribute your project, as most Windows users are accustomed to.
Simply check the "Embed project UIRs" box in menu Build>Target Settings... on the project window.
 
Here is an excerpt from the offical help text:
 
"Embeds .uir files into the executable. Enabling this option allows you to ship only the executable, instead of including the .uir files also. Make sure that you include all .uir files loaded through LoadPanel or LoadPanelEx in your project if you want to ship only the executable file. If you pass an absolute filename to LoadPanel or LoadPanelEx, the function will always look on disk for the .uir file. If you pass a simple filename, LoadPanel or LoadPanelEx will look first for an embedded .uir"
 
I know this feature is available in 8.0.1 but not in CVI 6.0. I do not know about 7.x versions.


Message Edited by ebalci on 02-22-2008 02:20 PM
S. Eren BALCI
IMESTEK
0 Kudos
Message 30 of 42
(16,647 Views)