开发者

WPF .NET: OpenSubkey() don't find value in registry

开发者 https://www.devze.com 2023-03-10 17:31 出处:网络
开发者_Python百科I\'ve created some values in Windows Registry and try to access them from .NET but there is an error.
开发者_Python百科

I've created some values in Windows Registry and try to access them from .NET but there is an error.

Registry.LocalMachine.OpenSubKey("SOFTWARE").OpenSubKey("ZvezdnyShop") is null, however there is an such key in Registry

REGEDIT http://astzvezdny.newsujet.com/REGEDIT.jpg ERROR IN VS http://astzvezdny.newsujet.com/VS.jpg

What's the matter?

ANSWER

My Application was 32bit, so I need place ZvezdnyShop at HKLM/Software/Wow6432Node Thanks to Frédéric Hamidi


The ZvezdnyShop key in your screenshot resides in the 64-bit portion of the registry, so it will only be visible to 64-bit applications.

Therefore, if your project targets the x86 platform, the 32-bit application it produces won't see that key.

To fix that problem, you can create the key in the 32-bit portion of the registry, i.e. HKLM\SOFTWARE\Wow6432Node\ZvezdnyShop, or have your project target the x64 platform.

0

精彩评论

暂无评论...
验证码 换一张
取 消