English 中文(简体)
为什么在我的Windows 7 64-bit系统上,开放式排位回落无效?
原标题:Why is OpenSubKey() returning null on my Windows 7 64-bit system?
最佳回答

如同unit检测项目,它汇编成64比。 在<代码>Compile 的单位测试项目环境中,将“Target CPU”设定为x86/code>(而不是AnyCPU)。

问题回答

如果你真的需要32个比照申请,你可以进入64个比照登记处:

RegistryKey localMachine64 = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64);
RegistryKey regKey = localMachine64.OpenSubKey(@"SoftwareMyCompanyMyApp", false);

是的,我也与Windows 7 64-bit和视觉演播室2008 SP1有着同样的问题。 但我的解决办法是相反的,即从“x86”改为“任何CPU”或“x64”。

可能关注的人

在我的考验中,如果你正在利用任何Cpu来制定该守则,使之达到开放式的SubKey,并在一个x64的非洲顾问办公室管理该守则,你就会发现,你没有在你所期望的领域工作。

例如:( 试验,载于4.5.2)

RegistryKey rsk = Registry.LocalMachine.OpenSubKey("SOFTWARE"); 

当你检查时。 GetSubKeyNames()

I checked this in debug , the result is neither HKLM nor HKCU, at least i cannot tell what it is (very much like HKCU but not the same).

最著名的问题是:

DeleteSubKeyTree will throw Argument Exception. if you try open the subkey before deleting, it is ok, but when doing the deletion, it will say, hey, it is not here...

因此,现在我永远不会再使用任何《公约》。





相关问题
Manually implementing high performance algorithms in .NET

As a learning experience I recently tried implementing Quicksort with 3 way partitioning in C#. Apart from needing to add an extra range check on the left/right variables before the recursive call, ...

Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

How do I compare two decimals to 10 decimal places?

I m using decimal type (.net), and I want to see if two numbers are equal. But I only want to be accurate to 10 decimal places. For example take these three numbers. I want them all to be equal. 0....

Exception practices when creating a SynchronizationContext?

I m creating an STA version of the SynchronizationContext for use in Windows Workflow 4.0. I m wondering what to do about exceptions when Post-ing callbacks. The SynchronizationContext can be used ...

Show running instance in single instance application

I am building an application with C#. I managed to turn this into a single instance application by checking if the same process is already running. Process[] pname = Process.GetProcessesByName("...

How to combine DataTrigger and EventTrigger?

NOTE I have asked the related question (with an accepted answer): How to combine DataTrigger and Trigger? I think I need to combine an EventTrigger and a DataTrigger to achieve what I m after: when ...