Click here to Skip to main content
15,882,055 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
I had an application developed in VC++ that uses a third party dll which also is developed in VC++
It works fine, and when checked with dependency walker, the application and dll depends on MFC42.dll, MSVCRT.dll, MSVCP60.dll etc.

The application is now ported to VS2008, and there is no change in the code that invoke the dll.
Normal functionalities works fine after invoking the DLL functions

But while trying to invoke function with Dialog, like

C++
MyFunc(void)
{
handle = AfxGetResourceHandle();
AfxSetResourceHandle(::GetModuleHandle(mydll));
if( myCDialog.DoModal() == IDOK )
{
/* My Functionality */
}
AfxSetResourceHandle(handle);
}

There is an error Access Violation in MFC42.dll (c0000005) while trying to execute DoModal.

The exe code is fine, as it can perfectly work with dll's made with VS2008 and higher.

Any way to resolve this error when using vc++ dll's in vs2008 exe?
Posted
Comments
Richard MacCutchan 13-Apr-14 4:17am    
Impossible to tell where the problem is, but you could try rebuilding the DLL under VS2008.

1 solution

I've never found MFC based projects to work very well when using different MFC versions in different libraries. Your best option is likely going to be try to upgrade the DLL.

Alternatively, you can try to look at the call stack to see what's causing the error. If I had to guess though, it's going to be something that doesn't make sense and is purely caused by differences in MFC.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900