程序结构:
1. 基于MFC扩展Dll, 用它封装了CWinApp派生的一个类: CMSDApp,其内部仅有一个InitInstance() 无任何代码(仅一句 return true )
2. TestFrame MFC对话框, CTestFrameApp由 CMSDApp派生。运行后出现:
TestFrame.exe 中的 0x7c172faf (mfc71.dll) 处未处理的异常: 0xC0000005: 读取位置 0x00000000 时发生访问冲突 。 出错后定位在int AFXAPI AfxWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPTSTR lpCmdLine, int nCmdShow)
{
...
if (!pThread->InitInstance()) <---- 出错定位
...
}
1. 基于MFC扩展Dll, 用它封装了CWinApp派生的一个类: CMSDApp,其内部仅有一个InitInstance() 无任何代码(仅一句 return true )
2. TestFrame MFC对话框, CTestFrameApp由 CMSDApp派生。运行后出现:
TestFrame.exe 中的 0x7c172faf (mfc71.dll) 处未处理的异常: 0xC0000005: 读取位置 0x00000000 时发生访问冲突 。 出错后定位在int AFXAPI AfxWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPTSTR lpCmdLine, int nCmdShow)
{
...
if (!pThread->InitInstance()) <---- 出错定位
...
}
CMSDWndApp::CMSDWndApp()
: CWinApp() // 增加的 <--
{
}
dll bebug -》exe bebug 运行就OK,其他的就还是不行。
dll release ==> exe release 可以运行,也可调试dll release ==> exe debug 就不行
出错是因为读内存错,
出错点:
if (!pThread->InitInstance()) <---- 出错定位 pThread == NULL