为了在注册表中方便存储自己的东西,我在MFC程序中的自动生成的语句
 SetRegistryKey(_T("应用程序向导生成的本地应用程序"));后自己添加了一句
SetRegistryKey(_T("MyProgramm"));编译的时候没问题,但是运行的时候会发出警告,点击忽略后不影响正常运行,我调试了下,发现警告是在下面标红那句:
void CWinApp::SetRegistryKey(LPCTSTR lpszRegistryKey)
{
ASSERT(m_pszRegistryKey == NULL);
ASSERT(lpszRegistryKey != NULL);
ASSERT(m_pszAppName != NULL); BOOL bEnable = AfxEnableMemoryTracking(FALSE);
free((void*)m_pszRegistryKey);
m_pszRegistryKey = _tcsdup(lpszRegistryKey);
free((void*)m_pszProfileName);
m_pszProfileName = _tcsdup(m_pszAppName);
AfxEnableMemoryTracking(bEnable);
}
我把这两句SetRegistryKey其中任意一个注释掉,都不会再出现警告了,请各位大神帮忙告诉一下为什么?