Registry.DoesKeyExist

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • pswauger
    Forum Member
    • Apr 2005
    • 16

    Registry.DoesKeyExist

    Maybe I am going crazy, but is anyone else having trouble using this function? I am trying to test if a certain MS hotfix is installed on a machine through the registry. Here is the code I am using:

    hotfix = Registry.DoesKeyExist(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uni nstall\\KB884020");

    if (hotfix == "true") then
    Dialog.Message("Notice", "Your message here.", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
    end

    As you can see I was just testing to see if the result was comming back true or not. I also tested it with false. Neither of these seem to be what is being returned. And before anyone asks yes this key does exist on the machine I am testing it on. Thanks for your assistance once again.
    -Pete
  • longedge
    Indigo Rose Customer
    • Aug 2003
    • 2496

    #2
    The space in Unin stall shouldn't be there should it.

    Comment

    • pswauger
      Forum Member
      • Apr 2005
      • 16

      #3
      sorry

      No there is no space. There was a typo when i coppied it into the forum.

      Comment

      • longedge
        Indigo Rose Customer
        • Aug 2003
        • 2496

        #4
        Hi, try -

        hotfix = Registry.DoesKeyExist(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uni nstall\\KB884020");

        if hotfix then
        Dialog.Message("Notice", "Reg Key for KB884020 exists.", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
        else
        Dialog.Message("Notice", "Reg Key for KB884020 does not exist.", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
        end

        Hmmmm... It's putting a space in there for me - strip that out. This code (without the space) works OK for me.
        Last edited by longedge; 04-22-2005, 08:04 AM.

        Comment

        • pswauger
          Forum Member
          • Apr 2005
          • 16

          #5
          Crazy as I thought. Many thanks for pointing me in the right direction.
          -Pete

          Comment

          • longedge
            Indigo Rose Customer
            • Aug 2003
            • 2496

            #6
            welcome :yes

            Comment

            Working...
            X