Options

Error by read register key

TirtaTirta Member Posts: 53
Hello..
anyone know what this error message means?
What to do?
Thanks.

Windows Script Host Object Model 1.0
This message is for C/AL programmers:

The call to member RegRead failed. WshShell.RegRead returned the following message:
Register key "HKCU ...." cannot open for read.

Comments

  • Options
    fbfb Member Posts: 246
    Registry keys have Permissions.

    Run Regedit.exe, highlight the key of interest, then click View, Permissions.

    Does the Navision user who is getting the error message have Read permission to the key?
  • Options
    kinekine Member Posts: 12,562
    Exists the key in registry? :-)
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • Options
    fbfb Member Posts: 246
    Also... When trying to read the (Default) value of a key, you must include a trailing '\'...
    If you forget the trailing '\', you will get the 'cannot open for read' error.
    // get the full path to fin.exe, stored in the registry as
    // the default value of the AppPaths\fin.exe key...
    FinExePath := 
      wshShell.RegRead(
        'HKLM\Software\Microsoft\Windows\CurrentVersion\App Paths\fin.exe\');
    
Sign In or Register to comment.