-bool wxIniConfig::Read(const wxString& szKey, wxString *pstr,
- const wxString& szDefault) const
-{
- wxConfigPathChanger path(this, szKey);
- wxString strKey = GetPrivateKeyName(path.Name());
-
- char szBuf[1024]; // @@ should dynamically allocate memory...
-
- // first look in the private INI file
-
- // NB: the lpDefault param to GetPrivateProfileString can't be NULL
- GetPrivateProfileString(m_strGroup, strKey, "",
- szBuf, WXSIZEOF(szBuf), m_strLocalFilename);
- if ( ::IsEmpty(szBuf) ) {
- // now look in win.ini
- wxString strKey = GetKeyName(path.Name());
- GetProfileString(m_strGroup, strKey, "", szBuf, WXSIZEOF(szBuf));
- }
-
- if ( ::IsEmpty(szBuf) ) {
- *pstr = szDefault;
- return FALSE;
- }
- else {
- return TRUE;
- }