装了VS2005 SP1之后,Debug版的Dll在一个需要弹出对话框的接口被调用时出错???
这个问题和CodeGuru论坛里的一个问题一样(http://www.codeguru.com/forum/showthread.php?threadid=460914),可惜没有人知道答案。
I have Visual Studio 2005 (Visual C++ 2005) and I have recently installed SP1. The problem is that I work on a DLL with MFC support and I cannot create a dialogbox any more!
the code I used and worked before installing SP1 was:
AFX_MANAGE_STATE(AfxGetStaticModuleState());
CChooseDlg c_dlg;
c_dlg.DoModal();but now it seems that I receive an assertion error, which, if I debug, it goes through here:
in CDialog::DoModal():
if (CreateDlgIndirect(lpDialogTemplate,
CWnd::FromHandle(hWndParent), hInst))
...in CWnd::CreateDialogIndirect(...):
if ( AfxGetApp()->IsKindOf( RUNTIME_CLASS( COleControlModule ) ) )in CObject::IsKindOf(...):
ENSURE(this != NULL);
我的情形和该贴中描述的一样:一开始的时候只是建立了一个简单的Dll工程,后来又需要弹出对话框,于是使用了MFC的一些功能。前段时间一直没问题,可以正常使用,但是自从把VS2005 SP1升级上去之后,就出现了这个问题,而且Release版的Dll没问题,但Debug版的有问题。这个Dll可以正常Load,只有那些使用了MFC对话框的接口,被调用时,会在Domodal()过程中遭遇上述断言失败。
这个问题在“一个使用动态链接库资源出错的难题” (http://topic.csdn.net/u/20080307/22/bbfe7258-0b2c-40aa-9424-4cf52edbd6a8.html)和“一个使用动态链接库资源出错的难题”(http://social.microsoft.com/Forums/pt-BR/visualcpluszhchs/thread/9e459adc-dc68-491a-8632-8cb23ef6566f),也讨论过。
期待大牛帮忙解决,谢谢!