[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 169
  • Last Modified:

Changing Registry programaticly

Hi to all!
I'm trying to change "GlobalUserOffline" in registry from my application.
this is the code I'm using:


HKEY hkey;
DWORD m_tmpWord;
m_tmpWord=0x00000000;
RegOpenKeyEx(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings", 0, KEY_ALL_ACCESS, &hkey);
RegSetValueEx(hkey,"GlobalUserOffline",0,REG_DWORD,(LPBYTE)&m_tmpWord,sizeof(DWORD));
RegCloseKey(hkey);

When I start application everything looks OK, but there isn't any change in registry.
What I'm doing wrong.

OS is Windows 2000, IE 6.

Greetings.
0
KukiPei
Asked:
KukiPei
  • 2
1 Solution
 
Jaime OlivaresCommented:
Try to use RegOpenKeyEx with KEY_READ security attribute.
0
 
KukiPeiAuthor Commented:
It doesn't work.
0
 
KukiPeiAuthor Commented:
I solved the problem.

Insted of HKEY_LOCAL_MACHINE I use HKEY_CURRENT_USER and everything work fine.

Becouse you are the only one who respond to my question I'l give you all points.
Thank you.
Greetings.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now