M
Micus
Hi All,
I've created a software package. I can install it (for everyone) in the
administrator account and it works great. I then switch to another
non-administrator account and open the application but the program fails to
read any values in the registry. I'm storing the value in the
HKEY_LOCAL_MACHINE\SOFTWARE. Can all users access this registry key? If not,
what root key should I put these values in? This is happening on a Win XP
machine, although I will need to have it install on a 2000 machine as well.
For those who are c++ Win32 savvy, here is the function:
double CRegistry::ReadString(cString strName, double fDefault)
{
HKEY m_hRootKey = HKEY_LOCAL_MACHINE;
cString m_strCurrentPath = "Software\\MyApp\\Settings";
HKEY hKey;
DWORD dwType = REG_SZ;
if :RegOpenKeyEx(m_hRootKey, LPCTSTR(m_strCurrentPath.c_str()), 0,
KEY_READ, &hKey) != ERROR_SUCCESS) return fDefault;
if :RegQueryValueEx(hKey, LPCTSTR(strName.c_str()), NULL,
&dwType, (LPBYTE)&d, &dwSize) != ERROR_SUCCESS) d = fDefault;
return fDefault;
}
Thank you - Micus
I've created a software package. I can install it (for everyone) in the
administrator account and it works great. I then switch to another
non-administrator account and open the application but the program fails to
read any values in the registry. I'm storing the value in the
HKEY_LOCAL_MACHINE\SOFTWARE. Can all users access this registry key? If not,
what root key should I put these values in? This is happening on a Win XP
machine, although I will need to have it install on a 2000 machine as well.
For those who are c++ Win32 savvy, here is the function:
double CRegistry::ReadString(cString strName, double fDefault)
{
HKEY m_hRootKey = HKEY_LOCAL_MACHINE;
cString m_strCurrentPath = "Software\\MyApp\\Settings";
HKEY hKey;
DWORD dwType = REG_SZ;
if :RegOpenKeyEx(m_hRootKey, LPCTSTR(m_strCurrentPath.c_str()), 0,
KEY_READ, &hKey) != ERROR_SUCCESS) return fDefault;
if :RegQueryValueEx(hKey, LPCTSTR(strName.c_str()), NULL,
&dwType, (LPBYTE)&d, &dwSize) != ERROR_SUCCESS) d = fDefault;
return fDefault;
}
Thank you - Micus