Link to home
Start Free TrialLog in
Avatar of nielsew
nielsew

asked on

Writing to the registry

How do a I write something to the registry directly under HKEY_CURRENT_USER

Currently when I use SetRegistryKey it places the key under \Software\

HKEY_CURRENT_USER\Software\"it goes here"

HKEY_CURRENT_USER\"I want it here!"

Thanks,
-Eric
ASKER CERTIFIED SOLUTION
Avatar of nil_dib
nil_dib

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of nielsew
nielsew

ASKER

Thanks!
forgot two things ...
replace hKey
with HKEY_LOCAL_MACHINE or HKEY_CURRENT_USER (in your case )....

replace the last lines with:

DWORD dwType = REG_DWORD;
LONG lRes = RegQueryValueEx(m_hKey, (LPTSTR)"DWORD", NULL, &dwType, NULL, &d6w);
if (lRes == ERROR_SUCCESS)
{
lRes = RegQueryValueEx(m_hKey, (LPTSTR)"DWORD", NULL, &dwType, (LPBYTE)&dwValue, &d6w);
...