Click here to Skip to main content
15,893,644 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi, all
I was trying to change some registry value on win7 using C++, and my code looks like this:
CRegKey cKey;
if(ERROR_SUCCESS == cKey.Open(HKEY_CURRENT_USER, _T("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\FileExts\\.htm\\UserChoice"), KEY_READ))
	cout << "opened!" << endl;
if(ERROR_SUCCESS == cKey.SetStringValue(_T("Progid"), _T("110"), REG_SZ))
	cout << "setted" << endl;

And of course I change the manifest file's level to "requireAdministrator".
But when I run this program, I can only see the "opened" message. It means that I can only open the registry, but cannot set the value.
Sometimes when I try to set some registry value manually, the system always said that "one or more applications may now use it" and I can't change the value.
Can someone please tell me how I can change the registry value in my project?
Is it something about the UAC level?
Any answers from you will be appreciated
Posted
Updated 20-Jun-11 14:54pm
v2

in that example above, you're only requesting
KEY_READ
access, which only gives you READ access to the handle you get back

try
VB
KEY_ALL_ACCESS
 
Share this answer
 
If you Google it, you might find some ways to do it.
 
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