在 VB.NET 中将 DWORD 值写入注册表

Writing DWORD Value to Registry in VB.NET

我有这段代码,本质上,我想制作它,以便程序将 DWORD 值而不是 "SV" 类型写入注册表。

这是我的代码:

My.Computer.Registry.LocalMachine.OpenSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\", True).SetValue("TestKey", "1")

看到MSDN docs about the method which shows that there is an additional parameter with the kind的价值写

所以试试这个

My.Computer.Registry.LocalMachine.OpenSubKey("...", True).SetValue("TestKey", 1, RegistryValueKind.DWord)