Click here to Skip to main content
15,902,198 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
When my program try to write something to the protected areas of the registry( under Windows 7), such as HKEY_LOCAL_MACHINE, I got access denied. At this time, I ask the user whether to restart the program and run as administrator. But, how can I achieve this goal?
Could someone help me?
Thanks!
Posted

While this is possible and someone else might tell you how, but take moment and think why do you need to access HKEY_LOCAL_MACHINE? It it really necessary to do it? Are you doing it just because you have been doing it for last version of your program?

Microsoft restricted access to HKEY_LOCAL_MACHINE and other system registry entries, folders etc for a reason. If not absolutely needed you should try to do it in the recommended way for Windows Vista and 7.

-Saurabh
 
Share this answer
 
Actually I want to register my own file extension, that means I must write data to HKEY_CLASSES_ROOT.
I know VS2008 and VS2010 can do this magical thing.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900