When I write to the Windows 7 Registry at HKEY_LOCAL_MACHINE, I get a return code of 5 which is the "access denied" message when I execute RegCreateKeyEx.

This happens even if the User has administrator rights.

How can I tell Windows 7 to allow the program to write to the registry?

The application is a 32-bit application and it should be allowed to run in either a Windows 7 32-bit or 64-bit machine.

I noticed that when I run certain popular programs, a User Account Control dialog box comes asking:
"Do if you want to allow the following program from an unknown publisher to make changes to this computer".

Should my application call User Account Control and if so, how do I do it in C++ Visual Studio 2008?

I also found out that 64-bit Windows machines have two registry hives. Is there a different code to handle the same task?

Any help will be appreciated.