954,498 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

problem with windows registry editing using C

I am currently running Windows Vista Servicepack1 amd I am using C-Free4.1 compiler.
plz check the C code...

# include <stdio.h>
# include <windows.h>
# include <winreg.h>
main()
{
	HKEY hkey;
	RegOpenKeyExA(HKEY_LOCAL_MACHINE,"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run",0,KEY_ALL_ACCESS,&hkey);
	RegSetValueExA(HKEY_LOCAL_MACHINE,"Testing",0,REG_SZ,"HELLO",5)	;
	RegCloseKey(HKEY_LOCAL_MACHINE);
}

Plz help me with this code or suggest me some good codes in C for registry editing in vista. when I am compiling it i am getting no errors and no warnings. but in registry I can't find the value "Testing". plz help me in registry programming... thanks in advance ......

dipanjanpal
Newbie Poster
2 posts since Dec 2010
Reputation Points: 10
Solved Threads: 0
 


may be you should try checking your user account control settings in control panel and turn it off

cool_zephyr
Junior Poster in Training
75 posts since Apr 2009
Reputation Points: 8
Solved Threads: 9
 
when I am compiling it i am getting no errors and no warnings. but in registry I can't find the value


It doesn't matter if it compiles OK or not. Your problem is at runtime.
Youmust check the return codes of the library functions you call, because C does not throw exceptions per se when a function fails as in Java, Python, etc.
Also study the doc.s of functions you call, http://msdn.microsoft.com/en-us/library/ms724875%28v=VS.85%29.aspx

ckoy
Light Poster
33 posts since Jul 2010
Reputation Points: 16
Solved Threads: 2
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: