I am trying to convert this registry code to my vb.net code... and having some trouble!
Here is the registry code:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\worldoftanks.exe\PerfOptions]
"CpuPriorityClass"=dword:00000003
This code makes the application "worldoftanks.exe" run at high priority at launch.
Here is my Vb.net code:
Try
Dim regKey As RegistryKey
regKey = Registry.LocalMachine.CreateSubKey("\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\worldoftanks.exe\PerfOptions", True)
regKey.SetValue("CpuPriorityClass", 3, RegistryValueKind.DWord)
regKey.Close()
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
For some reason I am receiving this error:
The specified RegistryKeyPermissionCheck value is invalid. Parameter name: mode
This is my first time dealing with registry through vb.net! If someone could help, that would be awesome!
Change your line to this: EDIT: There was an extra backslash in front of Software... it's been removed
regKey = Registry.LocalMachine.CreateSubKey("SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\worldoftanks.exe\PerfOptions", RegistryKeyPermissionCheck.ReadWriteSubTree, RegistryOptions.None)