CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2021
    Posts
    3

    Occcont.cpp error when migrating old VS2005 application to Visual Studio

    I am updating an application originally built in 2007 with Visual Studio 2022. I've made a few minor changes to get the program to compile successfully, but when I run the program it generates an assertion error on the DoModal() call:

    Code:
    CGenisysInteractApp theApp;
    
    /////////////////////////////////////////////////////////////////////////////
    // CGenisysInteractApp initialization
    
    BOOL CGenisysInteractApp::InitInstance()
    {
    	AfxEnableControlContainer();
    
    	// Standard initialization
    	// If you are not using these features and wish to reduce the size
    	//  of your final executable, you should remove from the following
    	//  the specific initialization routines you do not need.
    
    #ifdef _AFXDLL
    	//Enable3dControls();			// Call this when using MFC in a shared DLL
    #else
    	Enable3dControlsStatic();	// Call this when linking to MFC statically
    #endif
    	//Background color test
    	SetDialogBkColor(RGB(192,192,192), RGB(0,0,0));
    	
    	CGenisysInteractDlg dlg;
    	m_pMainWnd = &dlg;
    	int nResponse = dlg.DoModal();
    The assertion error generated is as follows:

    Code:
    Debug assertion failed!
    Program C:\WINDOWS\SYSTEM32\mfc140d.dll
    File: 
    d:\a01\_work\3\s\src\vctools\VC7Libs\ATLMFC\Src\MFC\occcont.cpp
    Line: 925
    I wanted to see what was happening in occcont.cpp to generate this error, and then I immediately recognized that I don't have ANY files on a path of d:\ on this computer. I'm assuming this was the path to the old directory on my old PC. So when I perform a search for the file, I located occcont.cpp in a different directory in C:\Program Files\Microsoft Visual Studio\2022\. So now I'm confused as to where to go next. I set a breakpoint in occcont.cpp at line 925 which never gets called:

    Code:
    921   OleControlSiteOrWnd *pTemp =
    922    new COleControlSiteOrWnd(
    923   hwndCtrl,
    924   pOccDlgInfo->m_pItemInfo[i].bAutoRadioButton);
    925   ASSERT(IsWindow(pTemp->m_hWnd));
    So question - why is VS2022 looking for this file in a directory that doesn't exist? It seems to be finding the file, or else it wouldn't have made it to line 925, right? What is this assertion error telling me?

  2. #2
    2kaud's Avatar
    2kaud is offline Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    7,609

    Re: Occcont.cpp error when migrating old VS2005 application to Visual Studio

    I suggest you create a new solution/project in VS2022 and add the required .cpp/.h et al files, set this solution/project properties as required and then compile. You shouldn't then have any reference to d:.
    All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++23 Compiler: Microsoft VS2022 (17.2.0)

  3. #3
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,218

    Re: Occcont.cpp error when migrating old VS2005 application to Visual Studio

    why is VS2022 looking for this file in a directory that doesn't exist? It seems to be finding the file, or else it wouldn't have made it to line 925, right? What is this assertion error telling me?
    I guess it is a design flaw of the Microsoft MFC team: rather than show the real path on the user machine they output the path of the file stored on some their developer machine.
    The same was in VS 2015/2017/2019
    Victor Nijegorodov

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured