• User-Friendly Access of Program Version

    Home » Forums » AskWoody support » Windows » Windows – other » User-Friendly Access of Program Version

    Author
    Topic
    #426413

    We have a custom plug-in that is installed via it’s own MSI.
    We have a business need to allow the users easy access to the version number of this plug-in.
    The problem is, in order to access the plug in, you need to go into runtime of the application that hosts it.

    Now, I know that the easiest way to access the version is to r/click on the executable and access the properties page, but the path is a bit too complex for the users.

    I want to try to modify the registry key that is accessible via the add remove programs in Control Panel.

    Currently the master MSI is hard coded to populate the version of this key with the initial version number.
    This is the key generated by the MSI that is logged into the registry and I want to modify that key with subsequent version values.

    Is there a way to programmatically modify this key? electric

    Viewing 0 reply threads
    Author
    Replies
    • #985475

      Yes, there is a way to do it. You can write, for example, VBS file to accomplish this task. Bur your information is insufficient. Let me explain.

      A content of the entry in “Currently Installed Programs” list in “Add or Remove Programs” control (appwiz.cpl) is stored in
      HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionUninstallDisplayName

      Where your custom plug-in is stored information about the latest version installed, is not clear. You can use REGREAD method to read this value and REGWRITE method to update DisplayName value.

      But if you want only to read which version version is installed once, you can simply to write VBS file which will display installed version. For example, this is VBS file that shows which version of Microsoft Office is installed:

      ‘————-Contenets of VBS File——————————-

      WScript.Echo “Microsoft Office version ” & GetOfficeVer()

      Function GetOfficeVer()

      sRegPre = “HKLMSOFTWAREMicrosoftOffice”
      sRegPost = “CommonInstallRoot”
      Select Case True
      Case RegKeyExists(sRegPre & “11.0” & sRegPost)
      sOfficeVer = “2003”
      Case RegKeyExists(sRegPre & “10.0” & sRegPost)
      sOfficeVer = “2002”
      Case RegKeyExists(sRegPre & “9.0” & sRegPost)
      sOfficeVer = “2000”
      Case RegKeyExists(sRegPre & “8.0” & sRegPost)
      sOfficeVer = “97”
      Case Else
      sOfficeVer = “None”
      End Select
      GetOfficeVer = sOfficeVer
      End Function

      Function RegKeyExists(ByVal sRegKey)
      ‘ Returns True or False based on the existence of a registry key.

      Dim sDescription, oShell
      Set oShell = CreateObject(“WScript.Shell”)

      RegKeyExists = True
      sRegKey = Trim (sRegKey)
      If Not Right(sRegKey, 1) = “” Then
      sRegKey = sRegKey & “”
      End If

      On Error Resume Next
      oShell.RegRead “HKEYNotAKey”
      sDescription = Replace(Err.Description, “HKEYNotAKey”, “”)

      Err.Clear
      oShell.RegRead sRegKey
      RegKeyExists = sDescription.Replace (Err.Description, sRegKey, “”)
      On Error Resume Next

      End Function

      ‘——————————End of File——————————————————-

      • #985479

        OK, good stuff, but the VBS file requires you to keep appending the case statement for every subsequent version created.

        I really am looking on how to programmatically modify the entry at the
        HKLMSoftwareMicrosoftWindowsCurrentVersionUninstall{CLSID} key.
        Specifically, the Display Version and possibly Contact keys

        Well, I thought I found out a way:
        – Toggle the attrib in the MSI from Read to Write
        – add in a version number in the dialog box
        – flip the attrib back to read.

        Thanks for the help

      • #986187

        I’ve modified the code to do partially what I want, but your code is geared using a case select to look through versions.
        I probably could use it, but the case names are much longer and not as clear as MS Office’s enrties.
        They have all kinds of quotes and special characters.

        I have the path working but I need to detect the following string from the Value Name property of the object:

        My_DocumentGenerator,Version=”1.0.1.189″,Culture=”neutral”

        These are the locations that make the sRegPre and sRegPost you have in the script:
        sRegPre HKLM/software/classes/installer/assemblies
        sRegPost = “D|Program Files|MyCo|LACE Document Generator”

    Viewing 0 reply threads
    Reply To: User-Friendly Access of Program Version

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: