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
Currently when I use SetRegistryKey it places the key under \Software\
HKEY_CURRENT_USER\Software
HKEY_CURRENT_USER\"I want it here!"
Thanks,
-Eric
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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);
...
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);
...
ASKER