Read Registry on Windows 7 with VBA Permission

限于喜欢 提交于 2021-02-05 11:58:06

问题


I have a line of code that has worked flawlessly for years on 50+ PCs (Vista & Windows 7 32 & 64 bit) in Access 2007 and Access 2010.

    RegStr = fReturnRegKeyValue(HKEY_LOCAL_MACHINE, "Software\ThisApp\App", "Activation")

On one specific PC (Windows 7 64bit) with An Access2010/VBA module (32 bit)

The line of code above does not see the registry key.

When I change HKEY_LOCAL_MACHINE to HKEY_CURRENT_USER,it works fine.

    RegStr = fReturnRegKeyValue(HKEY_CURRENT_USER, "Software\ThisApp\App", "Activation")

回答1:


One possible cause of issues like this is the registry virtualization that Microsoft added to Windows starting with Vista. When UAC (User Account Control) is enabled in Windows, non-privileged users can still "modify" system-wide settings like HKEY_LOCAL_MACHINE registry values, but those changes are "virtualized" for that user only and other users cannot see them.

In this case, one user may have run an application which saved settings to HKEY_LOCAL_MACHINE. That user will be able to retrieve those settings and run the application as normal, but another user won't be able to see those HKEY_LOCAL_MACHINE settings because they are only visible to the user that created them.



来源:https://stackoverflow.com/questions/17819921/read-registry-on-windows-7-with-vba-permission

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!