Skip to content

DoCreate - cVersionInfo

Reads the version information from a named application

Type: Procedure

Parameters

Parameter Type Description
sFileName WString Fully-qualified filename of the application to read the version information from

Syntax

Procedure DoCreate WString sFileName

Call Example

Send DoCreate sFileName

Description

The DoCreate procedure reads the version information from a named application. Typically, this message is not instantiated explicitly, as it is primarily used by the cApplication class to provide version information about the current application, so you do not need to send this message. However, if you want to read version information about a different application, then you will need to send this message explicitly with the filename of the application you want to retrieve version information about.

Sample

This example shows how to retrieve version information from the DataFlex Studio:

Procedure DoShowVersionInfo
    Handle hoVersionInfo hoRegistry
    Boolean bIncluded bKeyOpened
    String sRegKey sRootDir
    Integer iVersionMajor iVersionMinor iVersionRelease iVersionBuild            

    Get Create (RefClass(cVersionInfo)) To hoVersionInfo
    If (hoVersionInfo > 0) Begin
        Get Create (RefClass(cRegistry)) To hoRegistry
        If (hoRegistry > 0) Begin
            Set phRootKey Of hoRegistry To HKEY_LOCAL_MACHINE

            Move ("Software\Data Access Worldwide\DataFlex\" + Sysconf (SYSCONF_DATAFLEX_REV) + "\Defaults") To sRegKey
            Get OpenKey Of hoRegistry sRegKey To bKeyOpened
            If (bKeyOpened) Begin
                Get ReadString Of hoRegistry "DFRootDir" To sRootDir
                If (sRootDir <> "") Begin
                    If (Right (sRootDir, 1) <> SysConf (SYSCONF_DIR_SEPARATOR)) Begin
                        Move (sRootDir + SysConf (SYSCONF_DIR_SEPARATOR)) To sRootDir
                    End
                    Move (sRootDir + "Bin") To sRootDir
                End
            End

            Send Destroy Of hoRegistry
        End

        Send DoCreate of hoVersionInfo (sRootDir + "Studio.Exe")
        Get pbIncluded of hoVersionInfo To bIncluded
        If (bIncluded) Begin
            Get piVersionMajor Of hoVersionInfo To iVersionMajor
            Get piVersionMinor Of hoVersionInfo To iVersionMinor
            Get piVersionRelease Of hoVersionInfo To iVersionRelease
            Get piVersionBuild Of hoVersionInfo To iVersionBuild
            Send Info_Box (SFormat ("%1.%2.%3.%4", iVersionMajor, iVersionMinor, iVersionRelease, iVersionBuild))
        End
        Else Begin
            Send Info_Box "Sorry, Version Info was not embedded in Studio.Exe"
        End

        Send Destroy of hoVersionInfo // destroy the object
    End
End_Procedure

See Also

cApplication