Results 1 to 4 of 4
  1. #1
    4 Star Lounger
    Join Date
    May 2003
    Location
    Austin
    Posts
    401
    Thanks
    0
    Thanked 0 Times in 0 Posts

    User-Friendly Access of Program Version

    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? <img src=/S/electric.gif border=0 alt=electric width=15 height=15>

  2. #2
    Silver Lounger
    Join Date
    Apr 2001
    Location
    New York, New York, USA
    Posts
    2,328
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: User-Friendly Access of Program Version

    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_MACHINESOFTWAREMicrosoftWindowsCurrentV ersionUninstall< program name or CLSID >DisplayName

    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-------------------------------------------------------

  3. #3
    4 Star Lounger
    Join Date
    May 2003
    Location
    Austin
    Posts
    401
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: User-Friendly Access of Program Version

    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
    HKLMSoftwareMicrosoftWindowsCurrentVersionUninstal l{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

  4. #4
    4 Star Lounger
    Join Date
    May 2003
    Location
    Austin
    Posts
    401
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: User-Friendly Access of Program Version

    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"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •