First of all, I did search the entire forum but didn't find useful answer can solve my problem.
Here is my development tools and test environment information.
- Visual Studio 2013 with Update 3
- Windows Form desktop application with .NET Framework v2.0
- The language I am using is C#
- I tested with both Windows 8.1 and Windows 7 and run into same problem
I am a graphics driver engineer and want to develop some tools for internal usage. .NET Framework give me the fastest way to create a decent GUI tool and this is reason why I choose it.
As I am working with graphics driver, I need update the keys under "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Video".
However, I run into the problem with the following line of code,
RegistryKey theVideoKey = Registry.LocalMachine.CreateSubKey(theKeyStr);
The error message is:
An unhandled exception of type 'System.UnauthorizedAccessException' occurred in mscorlib.dll
Additional information: Access to the registry key 'HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Video\{????}\0000' is denied.
I tried everything I think could be useful found on the forum, such as "run as Adminitrator" but it doesn't work. Please help.