Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Question about CAxDialogImpl class in VC++ 6.0

Question about CAxDialogImpl class in VC++ 6.0

Scheduled Pinned Locked Moved C / C++ / MFC
questionc++
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    Barry True
    wrote on last edited by
    #1

    We've got two classes that we use to resize standard CDialog-based classes and to show a resize handle in the lower right-hand corner of the dialog. These work fine when the class is derived from CDialog. However, if the class is derived from CAxDialogImpl we have problems instantiating the class that shows the resize handle. The class used to show the resize handle is called CEasyStatusBar and is derived from CStatusBarCtrl. The class has a Create() method which is the first method that classes that use the CEasyStatusBar class must invoke. The Create() takes a CWnd pointer which is normally passed as the this pointer from CDialog based classes. However in the CAxDialogImpl class we are using CWnd::FromHandle(m_hWnd) to get the CWnd pointer to pass in to the Create() method. The Create() method does a few things and then invokes the CStatusBarCtrl::Create() method as follows: BOOL IsVisible = parent->IsWindowVisible(); // parent is the CWnd pointer DWORD ProgressBarStyle = WS_CHILD | CCS_BOTTOM | SBARS_SIZEGRIP | SBT_OWNERDRAW; CStatusBarCtrl::Create(ProgressBarStyle, CRect(0, 0, 0, 0), parent, 1); When it gets into the CStatusBarCtrl::Create() method an assertion failure is being generated. I debugged into this to find out where and it is performing the following: The CStatusBarCtrl::Create() method is invoking VERIFY(AfxDeferRegisterClass(AFX_WNDCOMMCTL_BAR_REG)). This is invoking AfxEndDeferRegisterClass() which is doing the following: // mask off all classes that are already registered AFX_MODULE_STATE* pModuleState = AfxGetModuleState(); fToRegister &= ~pModuleState->m_fRegisteredClasses; if (fToRegister == 0) return TRUE; LONG fRegisteredClasses = 0; // common initialization WNDCLASS wndcls; memset(&wndcls, 0, sizeof(WNDCLASS)); // start with NULL defaults Wndcls.lpfnWndProc = DefWindowProc; Wndcls.hInstance = AfxGetInstanceHandle(); The first thing the AFxGetInstanceHandle() method does is do an ASSERT(afxCurrentInstanceHandle != NULL) which is failing and causing the assertion fault. I debugged into this with one of our other classes based on CDialog and in that one, fToRegister was set to 0 so it was never getting to the AfxGetInstanceHandle() method. Does anyone have any clues as to what could be causing our CAxDialogImpl-based class to get the above assertion failure? -- modified at 18:46 Saturday 29th April, 2006

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups