Getting the version of Inventor programatically

Top  Previous  Next

Here is the code to do it:

 

    CComPtr<Application> pInvApp = ...

 

    CComBSTR bstrVersion ;

    pInvApp->SoftwareVersion->get_DisplayName (&bstrVersion) ;

    TRACE (L"Software version DisplayName is <%s>\n",bstrVersion) ;

 

    pInvApp->SoftwareVersion->get_DisplayVersion (&bstrVersion) ;

    TRACE (L"Software version DisplayVersion is <%s>\n",bstrVersion) ;

 

And the output in your debug window will look something like this:

 

Software version DisplayName is <2013 (Build 170138000, 138)>

Software version DisplayVersion is <2013>

 

Apart from DisplayName and DisplayVersion there are other functions like get_Major and get_Minor. For example:

 

    long iMajorVer ;

    pInvApp->SoftwareVersion->get_Major (&iMajorVer) ;

 

    long iMinorVer ;

    pInvApp->SoftwareVersion->get_Minor (&iMinorVer) ;

 

    TRACE (L"Software version Major=%d, Minor=%d\n",iMajorVer,iMinorVer) ;

 

with this result:

 

Software version Major=17, Minor=0

 

But I don't find numbers as helpful as the display strings.

 

 

 

Text, images and diagrams © 2021 Owen F. Ransen. All rights reserved. (But copy the source code as much as you want!)