You can easily switch to using INI files. The major problem you will have is deciding where to put them - Microsoft discourages writing into any of the C:\Program Files folders, which is where your app will usually be installed. But, once you know where you want it, switching to INI file is easy:
Construct path to INI file:
BOOL CApp::InitInstance()
{
.
.
.
m_strProfileFilePath = ""; // m_strProfileFilePath is CString member of CApp
// let's put INI in exe directory
m\_strProfileFilePath = GetModulePath();
m\_strProfileFilePath += "\\\\";
m\_strProfileFilePath += "MyApp.ini";
Next we need to clean up MFC's default INI string:
// save our ini file name --
// first free the string allocated by MFC at CWinApp startup.
// The string is allocated before InitInstance is called.
free((void\*)m\_pszProfileName);
// Change the name of the .INI file.
// The CWinApp destructor will free the memory.
// Note: must be allocated on heap
m\_pszProfileName = \_strdup(m\_strProfileFilePath);
Now we can use the standard profile functions in CWinApp:
// write some stuff to INI file
// [FilesToAdd]
// File001=CRASH.DMP,Crash Dump,DMP File
// File002=ERRORLOG.TXT,Crash log,Text Document
// File003=MyApp.ini,INI File,Text Document
WriteProfileString("FilesToAdd", "File001", "CRASH.DMP,Crash Dump,DMP File");
WriteProfileString("FilesToAdd", "File002", "ERRORLOG.TXT,Crash log,Text Document");
WriteProfileString("FilesToAdd", "File003", "MyApp.ini,INI File,Text Document");
.
.
.
Best wishes, Hans
[CodeProject Forum Guidelines] [How To Ask A Question] [My Articles]