T
also CString CWinApp::GetProfileString sieht so aus:
CWinApp::GetProfileString(LPCTSTR lpszSection, LPCTSTR lpszEntry,
LPCTSTR lpszDefault)
{
ASSERT(lpszSection != NULL);
ASSERT(lpszEntry != NULL);
if (m_pszRegistryKey != NULL)
{
HKEY hSecKey = GetSectionKey(lpszSection);
if (hSecKey == NULL)
return lpszDefault;
CString strValue;
DWORD dwType, dwCount;
LONG lResult = RegQueryValueEx(hSecKey, (LPTSTR)lpszEntry, NULL, &dwType,
NULL, &dwCount);
if (lResult == ERROR_SUCCESS)
{
ASSERT(dwType == REG_SZ);
lResult = RegQueryValueEx(hSecKey, (LPTSTR)lpszEntry, NULL, &dwType,
(LPBYTE)strValue.GetBuffer(dwCount/sizeof(TCHAR)), &dwCount);
strValue.ReleaseBuffer();
}
RegCloseKey(hSecKey);
if (lResult == ERROR_SUCCESS)
{
ASSERT(dwType == REG_SZ);
return strValue;
}
return lpszDefault;
}
else
{
ASSERT(m_pszProfileName != NULL);
if (lpszDefault == NULL)
lpszDefault = &afxChNil; // don't pass in NULL
TCHAR szT[4096];
DWORD dw = ::GetPrivateProfileString(lpszSection, lpszEntry,
lpszDefault, szT, _countof(szT), m_pszProfileName);
ASSERT(dw < 4095);
return szT;
}
}
vielleicht hilft ja ein vergleich