Debug Assertion Failed at AfxGetResourceHandle()
-
I have seen this question before ,but i dont get the answer i want. I develop programme with VC6.0 SP6.When i export a modal dialog in MFC extension DLL , i get the Debug Assertion.The most weird is when the DLL and the app(which uses the dll)are both Debug or Release Edition , every thing goes well.But when the DLL is Debug Edition while the App is Release Edition, i get a Debug Assertion Failed at AfxGetResourceHanle .What causes this happen????:sigh: I need your help~~~~~~~~ Thanks in advance.:sigh:
-
I have seen this question before ,but i dont get the answer i want. I develop programme with VC6.0 SP6.When i export a modal dialog in MFC extension DLL , i get the Debug Assertion.The most weird is when the DLL and the app(which uses the dll)are both Debug or Release Edition , every thing goes well.But when the DLL is Debug Edition while the App is Release Edition, i get a Debug Assertion Failed at AfxGetResourceHanle .What causes this happen????:sigh: I need your help~~~~~~~~ Thanks in advance.:sigh:
What line of what file is asserting?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
-
What line of what file is asserting?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
thanks for your reply. The Debug Assertion occurs at line 22 in AFXWIN1.INL, // _AFXWIN_INLINE HINSTANCE AFXAPI AfxGetResourceHandle() //line 21 { ASSERT(afxCurrentResourceHandle != NULL); //line 22 return afxCurrentResourceHandle; } //line 23 // I think it must be a abnormal initialization of module state in App.But i dont know how to fix it.
-
I have seen this question before ,but i dont get the answer i want. I develop programme with VC6.0 SP6.When i export a modal dialog in MFC extension DLL , i get the Debug Assertion.The most weird is when the DLL and the app(which uses the dll)are both Debug or Release Edition , every thing goes well.But when the DLL is Debug Edition while the App is Release Edition, i get a Debug Assertion Failed at AfxGetResourceHanle .What causes this happen????:sigh: I need your help~~~~~~~~ Thanks in advance.:sigh:
for the purpose of test , i created a compeletly new MFC extension DLL project and a accompanying MFC EXE app which implicitly loads the MFC ext DLL .Then i insert a Dialog resource by using wizard and dynamically create a instance of class CDialog using the dialog resource i inserted before. After that , i invoke the DoMdal() method of the CDialog instance and wrapped this invoke into a exported function named Test . Then , rebuild and produce the debug edtion of this DLL. In the app , i just call the function Test . Of course , the app is release edtion. Then , run the app , and the debug assertion occurs. just before the invoke of DoModal() function ,i insert a statement : // AFX_MODULE_STATE *pState = AfxGetModuleState(); // Run debugger , I found that resource handle ,moudle handel , and winapp object..ect , all were NULL.So this could explain why the debug assertion raises. Then , i change the app into debug edtion , and found that all the fields in the AFX_MOUDLE_STATE were correctly filled. how could this happen??!!!!!!!:^)
-
thanks for your reply. The Debug Assertion occurs at line 22 in AFXWIN1.INL, // _AFXWIN_INLINE HINSTANCE AFXAPI AfxGetResourceHandle() //line 21 { ASSERT(afxCurrentResourceHandle != NULL); //line 22 return afxCurrentResourceHandle; } //line 23 // I think it must be a abnormal initialization of module state in App.But i dont know how to fix it.
In your exported
Test()
function, do you have the following as the first statement:AFX_MANAGE_STATE(AfxGetStaticModuleState());
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
-
I have seen this question before ,but i dont get the answer i want. I develop programme with VC6.0 SP6.When i export a modal dialog in MFC extension DLL , i get the Debug Assertion.The most weird is when the DLL and the app(which uses the dll)are both Debug or Release Edition , every thing goes well.But when the DLL is Debug Edition while the App is Release Edition, i get a Debug Assertion Failed at AfxGetResourceHanle .What causes this happen????:sigh: I need your help~~~~~~~~ Thanks in advance.:sigh:
Now faced with the same problem. Tell me, how did you solve it (if you figured it out)?