cophi
asked on
Save Property Page
I have a custom active X. On that property page I've added 3 CEdit controls. What's the best way to save those values so when I use the control again, the boxes are prepopulated with them.
Thanks,
Thanks,
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Check in the help file - I'm out of the office for the next hour or so. sorry.
eg.
CRegKey regKey;
if(SUCCEEDED(regKey.Open(H KEY_CURREN T_USER, _T("SOFTWARE\\MYAPP"))))
{
regKey.SetStringValue(_T(" Benutzer") , _T("Me"));
}
CRegKey regKey;
if(SUCCEEDED(regKey.Open(H
{
regKey.SetStringValue(_T("
}
You may refer this 'CRegSettings - registry helper class' Src Code :
http://www.codeproject.com/system/regsettings.asp <===== Simple class to store application settings in registry
-MAHESH
http://www.codeproject.com/system/regsettings.asp <===== Simple class to store application settings in registry
-MAHESH
Above is easy to use as to Load use and Save From and To Registry.
//Call constructor to set values
CMySettings settings(HKEY_CURRENT_USER , "Software\\%s\\%s\\%i", "MyCompany", "MyApplication", intValue);
..
settings.Load(); // Load configuration
... // use values settings.Value1 etc.
settings.Save(); // Save configuration
Refer above link CMySettings class src files for more.
-MAHESH
//Call constructor to set values
CMySettings settings(HKEY_CURRENT_USER
..
settings.Load(); // Load configuration
... // use values settings.Value1 etc.
settings.Save(); // Save configuration
Refer above link CMySettings class src files for more.
-MAHESH
Alternatively you have look at this : http://www.codeproject.com/cpp/siv_settings.asp <==Simple settings implementation
This one saves settings in text file. Dialog application demo with Edit controls are there to demonstrate saving settings.
-MAHESH
This one saves settings in text file. Dialog application demo with Edit controls are there to demonstrate saving settings.
-MAHESH
ASKER
Why does this fail???
#define GLOBALREGKEY HKEY_LOCAL_MACHINE
#define GLOBALREGLOCATION "ABC\\Test\\Configurations "
if(l_regKey.Create(GLOBALR EGKEY, GLOBALREGLOCATION, REG_NONE, REG_OPTION_NON_VOLATILE, KEY_WRITE)==ERROR_SUCCESS)
#define GLOBALREGKEY HKEY_LOCAL_MACHINE
#define GLOBALREGLOCATION "ABC\\Test\\Configurations
if(l_regKey.Create(GLOBALR
Extract from help.
If successful, returns ERROR_SUCCESS and opens the key. If the method fails, the return value is a nonzero error code defined in WINERROR.H.
long lRet = l_regKey.Create(GLOBALREGK EY, GLOBALREGLOCATION, REG_NONE, REG_OPTION_NON_VOLATILE, KEY_WRITE);
if(lRet==ERROR_SUCCESS)
{
Do your stuff
}
else
{
TRACE("Create failed with %ld\n", lRet);
}
What do you get as the returned value in the TRACE output?
If successful, returns ERROR_SUCCESS and opens the key. If the method fails, the return value is a nonzero error code defined in WINERROR.H.
long lRet = l_regKey.Create(GLOBALREGK
if(lRet==ERROR_SUCCESS)
{
Do your stuff
}
else
{
TRACE("Create failed with %ld\n", lRet);
}
What do you get as the returned value in the TRACE output?
ASKER
87
ASKER
#define GLOBALREGLOCATION "ABC\\Test\\Configurations "
apparantly 87 is invalid parameter.
does the globalreglocation have to be a location thats already created. I figured this would create the whole 'tree' for you.
apparantly 87 is invalid parameter.
does the globalreglocation have to be a location thats already created. I figured this would create the whole 'tree' for you.
ASKER
Um apparantly it didn't like HKEY_LOCAL_MACHINE
HKEY_CURRENT_USER worked??
Any ideas y
HKEY_CURRENT_USER worked??
Any ideas y
User rights - could it be you don't have suitable rights to modify keys in HKEY_LOCAL_MACHINE ?
ASKER