LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

How to use "build number" in program

Hallo users,
in many professional software one finds a "build number" which identifies the release version of a program. My questions regarding this number are:
- How do these numbers work? These build numbers look like 6.05.1043 or something like that.
- How could I probably use such a number in my program in such a way, that e.g. the build number is automatically displayed in the main panel's title bar? This would allow to easily distinguish between different releases of the program. That would mean that LabWindows would be somehow able to create such a build number and would automatically increase this number after each compiler run.

Thanks
Thomas
0 Kudos
Message 1 of 9
(4,977 Views)
version number a.b.c.d means:
a - major
b - minor
c - revision
d - build

the build number will increment automatically!

if you want to read the vision number of your cvi software take the the function GetCVIVersion (you also can find an example in the NI Example Finder - Index - search term: "version")

regards,
Thomas Sandrisser
NI Germany
Message 2 of 9
(4,975 Views)
Thomas,
are you sure on what you have written in this thread? When I look into the panel help of GetCVIVersion () in my CVI (Version 8.1), I can read the following:
 
"Returns the version of the LabWindows/CVI Run-time Libraries that you are using.
The value is in the form Nnn, where the N.nn is the version number the About LabWindows/CVI dialog box shows.
For example, for LabWindows/CVI version 5.0, GetCVIVersion returns 500. For version 4.0.1, it returns 401. The values always increase with each new version of LabWindows/CVI.
Do not confuse the return value of GetCVIVersion with the predefined macro _CVI_, which specifies the version of LabWindows/CVI in which the source file is compiled."
 
This seems to contradict to your description.
Torsten
0 Kudos
Message 3 of 9
(4,779 Views)
Hi Lenin,
 
There are functions to get the version of the executable in the Windows SDK (winver.h).  If you have the Windows SDK in CVI, there is an example that shows how to get the version number: [CVI DIR]\samples\sdk\verinfo.
Cheers,

David Goldberg
National Instruments
Software R&D
0 Kudos
Message 4 of 9
(4,751 Views)
Dear David,
thanks for your reply.
OK as I understand the Windows SDK provides functionality to read the version information during runtime. This is helpful when I want to display this information in an About Box of my application. But this is only half of the goal. What I'm also looking for is to increment the build number each time the application is build in CVI. I noticed methods for getting and setting the version information in the CVI ActiveX server (CVI_AppGetProjectVersionInfo () and CVI_AppSetProjectVersionInfo () ). So I wrote a small command line "version increment" tool that does the job and added this to the build steps of my project. Unfortunateley this causes the CVI IDE to block when a build is performed. The only way out is to kill CVI using task manager. Using debug messages written to a log file I traced the problem down to the CVI_ActiveApp() method that I call in the "version increment" tool to give me a reference to the actual running CVI. This works fine when I call the "version increment" tool "by hand" from the explorer (with CVI in idle state), but causes the above described blocking situation when a build process is ongoing and the "version increment" tool is called as a build step. The behaviour is independent which build step I use.
 
Any suggestions?
Thanks
Torsten
0 Kudos
Message 5 of 9
(4,717 Views)
Hi Torsten,
 
Can you please attach your code that updates the version of CVI?  I will look into this.
Cheers,

David Goldberg
National Instruments
Software R&D
0 Kudos
Message 6 of 9
(4,668 Views)

David,

please find attached the requested code. It looks a little bit funny because I did an extra log file instrumentation to trace the problem down. Remember that it does not work in the debugger, because in this situation the CVI IDE is not idle and the call of CVI_AppGetProjectVersionInfo() causes the reasonable error message "The operation cannot be performed because a user program is currently running."

To test the tool, just build the release version and run it from the command line when the CVI IDE is open but idle. In this case it works fine. It hangs the CVI IDE when called as a build step.

For completeness I also attached the CVI ActiveX-Server FP I generated for that.

Just to note, I use CVI 8.1 with CVIRTE 8.1.1 on WinXPSP2.

Many thanks

Torsten

0 Kudos
Message 7 of 9
(4,654 Views)

Hi Torsten,

I can reproduce this hang, and am currently checking with R&D.  Thank you for letting us know.  I will let you know what we find.

Cheers,

David Goldberg
National Instruments
Software R&D
0 Kudos
Message 8 of 9
(4,614 Views)

Hi Torsten,

Essentially the problem you are encountering is the fact that you can't set the file and product version of an executable after the build process has already started. The reason for this is because the file, product version, and build steps are all stored within the project file. This project file gets loaded into memory as soon as you start the build process and thus any changes you make to the file on the hard drive won't be seen.  Even though what you are trying to do won't work, CVI still shouldn't hang so this will have to be looked into more. 

Thus your options for what you are trying to achieve are:

1) Use the CVI command-line compiler which allows you build a CVI project from the command line and even specify a bunch of arguments including: fileVersion, productVersion, fileVersionText, productVersionText, etc. See the Using the LabWindows/CVI Command Line Interface help topic in the NI LabWindows/CVI Help.

2) Have one "dummy" CVI program programmatically build your "real" CVI program via CVI's ActiveX server. You would programmatically set the file and product versions and then call the build method. This is shown in the build.prj example located in the
<CVI>\samples\activex\cvi\ directory.


I know these aren't the exact solutions you were looking for, but hope this help.

Best Regards,

Jonathan N.
National Instruments
0 Kudos
Message 9 of 9
(4,606 Views)