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 ......

Recommended Answers

All 2 Replies

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

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.
You must 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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.