Announcement

Collapse
No announcement yet.

Registry.DoesKeyExist

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Registry.DoesKeyExist

    Why does Registry.DoesKeyExist() product a error line in the setup log when the key you are looking for does not exist. This seems to defeat the purpose of the function, which I think is to test whether the key exists so that it can be referenced without causing a error?

  • #2
    I don't see this. With this sample code
    Code:
    if not Registry.DoesKeyExist(HKEY_CURRENT_USER, "Something") then
       SetupData.WriteToLogFile("Info\tHKCU\\Something does not exist\r\n", true);
    end
    if not Registry.DoesKeyExist(HKEY_CURRENT_USER, "Something\\Anything") then
       SetupData.WriteToLogFile("Info\tHKCU\\Something\\Anything does not exist\r\n", true);
    end
    if not Registry.DoesKeyExist(HKEY_LOCAL_MACHINE, "Something") then
       SetupData.WriteToLogFile("Info\tHKLM\\Something does not exist\r\n", true);
    end
    if not Registry.DoesKeyExist(HKEY_LOCAL_MACHINE, "Something\\Anything") then
       SetupData.WriteToLogFile("Info\tHKLM\\Something\\Anything does not exist\r\n", true);
    end
    I get these results:
    Code:
    ...
    [10/29/2013 16:33:57] Notice	Start project event: On Startup
    [10/29/2013 16:33:57] Info	HKCU\Something does not exist
    [10/29/2013 16:33:57] Info	HKCU\Something\Anything does not exist
    [10/29/2013 16:33:57] Info	HKLM\Something does not exist
    [10/29/2013 16:33:57] Info	HKLM\Something\Anything does not exist
    [10/29/2013 16:33:57] Success	Run project event: On Startup
    ...
    Maybe you could post the actual code and error log - something else might be happening. Also, which version are you using?

    Ulrich

    Comment

    Working...
    X