Runtime error: MFC71.dll AfxTermExtensionModule

Posted on 2004-10-01
Last Modified: 2013-12-03

Anyone knows what this runtime error is about?

>      MFC71.dll!AfxTermExtensionModule(AFX_EXTENSION_MODULE & state={...}, int bAll=1)  Line 185 + 0x4      C++

void AFXAPI AfxTermExtensionModule(AFX_EXTENSION_MODULE& state, BOOL bAll)
      // make sure initialized
      if (!state.bInitialized)

      // search for CDynLinkLibrary matching state.hModule and delete it
      ASSERT(state.hModule != NULL);
      AFX_MODULE_STATE* pModuleState = AfxGetModuleState();
      for (CDynLinkLibrary* pDLL = pModuleState->m_libraryList; pDLL != NULL; )
            CDynLinkLibrary* pNextDLL = pDLL->m_pNextDLL;
            if (bAll || pDLL->m_hModule == state.hModule)
                  delete pDLL;    // will unwire itself     <------------------------------ Line 185
            pDLL = pNextDLL;

      // delete any local storage attached to this module
      AfxTermLocalData(state.hModule, TRUE);

      // remove any entries from the CWnd message map cache

Many thanks..
Question by:ewong_111
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2

Author Comment

ID: 12202803

Forgot to post the output..

First-chance exception at 0x7c18079f (MFC71.dll) in DLLClient.exe: 0xC0000005: Access violation reading location 0x7c003337.
Unhandled exception at 0x7c18079f (MFC71.dll) in DLLClient.exe: 0xC0000005: Access violation reading location 0x7c003337.


Accepted Solution

mxjijo earned 500 total points
ID: 12205123

Web Quote :

Add the following line to the DLL_PROCESS_DETACH section of an AppWizard- generated Extension DLL's DllMain():    else if (dwReason == DLL_PROCESS_DETACH)
      // Add the following line

          // TODO: perform other cleanup tasks here

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article, I will show how to use the Ribbon IDs Tool Window to assign the built-in Office icons to a ribbon button.  This tool will help us to find the OfficeImageId that corresponds to our desired built-in Office icon. The tool is part of…
For a while now I'v been searching for a circular progress control, much like the one you get when first starting your Silverlight application. I found a couple that were written in WPF and there were a few written in Silverlight, but all appeared o…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA.…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

724 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question