Saving configuration option data
-
I have configuration dialogbox where the user uses the combo box to select and set the configuration. Now how and where can i save the configuration data. and how to retrive last saved configuration Thanks, KarmU
-
I have configuration dialogbox where the user uses the combo box to select and set the configuration. Now how and where can i save the configuration data. and how to retrive last saved configuration Thanks, KarmU
-
I have configuration dialogbox where the user uses the combo box to select and set the configuration. Now how and where can i save the configuration data. and how to retrive last saved configuration Thanks, KarmU
You can use the windows registry for storing your data. The platform SDK provides a set of functions to access the registry. Search MSDN. Another way is to store the data in a text file. This is very easy using the MFC class CStdioFile. MS
-
I have configuration dialogbox where the user uses the combo box to select and set the configuration. Now how and where can i save the configuration data. and how to retrive last saved configuration Thanks, KarmU
karmendra_js wrote: Now how and where can i save the configuration data. and how to retrive last saved configuration There are many option for saving and reteriving the configurations-> [INI] [http://www.codeproject.com/cpp/cinifile.asp](http:// http://www.codeproject.com/cpp/cinifile.asp)[[^](http:// http://www.codeproject.com/cpp/cinifile.asp)] [Registry] look for
CRegKey
in you local copy of MSDN [Serialize] http://www.codeproject.com/cpp/serialization_primer1.asp[^]"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers, Alok Gupta VC Forum Q&A :- I/ IV
-
You can use the windows registry for storing your data. The platform SDK provides a set of functions to access the registry. Search MSDN. Another way is to store the data in a text file. This is very easy using the MFC class CStdioFile. MS
i used the following code but it gives assertion failure why? CStdioFile f; char buf[] = "test string"; f.WriteString( buf );
-
i used the following code but it gives assertion failure why? CStdioFile f; char buf[] = "test string"; f.WriteString( buf );
You need to open the file before writing to it. Do it this way: CStdioFile file; CString lineOfText; file.Open("C:\\exaplepath\\examplefile.xyz", CFile::modeCreate|CFile::modeReadWrite); lineOfText="This is the first line"; lineOfText+="\r\n"; file.Writestring(lineOfText); lineOfText="This is the second line"; lineOfText+="\r\n"; file.Writestring(lineOfText); file.Close(); MS
-
karmendra_js wrote: Now how and where can i save the configuration data. and how to retrive last saved configuration There are many option for saving and reteriving the configurations-> [INI] [http://www.codeproject.com/cpp/cinifile.asp](http:// http://www.codeproject.com/cpp/cinifile.asp)[[^](http:// http://www.codeproject.com/cpp/cinifile.asp)] [Registry] look for
CRegKey
in you local copy of MSDN [Serialize] http://www.codeproject.com/cpp/serialization_primer1.asp[^]"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers, Alok Gupta VC Forum Q&A :- I/ IV
http://www.codeproject.com/cpp/cinifile.asp\[^\] this link doesn't work. and can i get an example code how to use CRegKey class for storing and retriving data. I have around 11 feilds and i want to save them all. thanks.
-
http://www.codeproject.com/cpp/cinifile.asp\[^\] this link doesn't work. and can i get an example code how to use CRegKey class for storing and retriving data. I have around 11 feilds and i want to save them all. thanks.
karmendra_js wrote: _http://www.codeproject.com/cpp/cinifile.asp_ just try http://www.codeproject.com/cpp/cinifile.asp
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers, Alok Gupta VC Forum Q&A :- I/ IV
-
I have configuration dialogbox where the user uses the combo box to select and set the configuration. Now how and where can i save the configuration data. and how to retrive last saved configuration Thanks, KarmU
You can consider using the Registry to save your configuration data. Proceed as under (with MFC): 1. Use functions such as SetRegistryKey, WriteProfileString (for a string), WriteProfileInt (for int), GetProfileString, GetProfileInt, etc., of the application class for setting and accessing values from the Registry. 2. You can consider the Constructor or InitDialog functions wherein the stored values can be retrieved from Registry and displayed in the Configuration dialogbox. 3. Use OnOK (or whatever other button-event-handlers) to save the changed configuation data to registry. 4. Use these stored values appropriately in the code to change your program response. For example, use PreCreateWindow function of the mainframe class to change the position or size of main window using stored configuration data. Regards, Ashok Dhamija _____________________________ Padam Technologies
-
http://www.codeproject.com/cpp/cinifile.asp\[^\] this link doesn't work. and can i get an example code how to use CRegKey class for storing and retriving data. I have around 11 feilds and i want to save them all. thanks.
karmendra_js wrote: http://www.codeproject.com/cpp/cinifile.asp this link doesn't work. Did you not notice the extra stuff in the URL? Try it again but remove the extraneous characters.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
-
I have configuration dialogbox where the user uses the combo box to select and set the configuration. Now how and where can i save the configuration data. and how to retrive last saved configuration Thanks, KarmU
Hi, honestly I don't like Bill's registry very much... If I need to store any configuration data this is my preferred way. Regards Achikm Klein
We can do no great things, only small things with great love. - Mother Theresa
-
Hi, honestly I don't like Bill's registry very much... If I need to store any configuration data this is my preferred way. Regards Achikm Klein
We can do no great things, only small things with great love. - Mother Theresa
Achim Klein wrote: honestly I don't like Bill's registry very much... Yeap Nice, But still you using Bill's Window for storing the data ?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers, Alok Gupta VC Forum Q&A :- I/ IV