Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS Tech Support » Problem with OLE Active In place. Collapse All
Subject Author Date
Christan HIRIGOYEN Sep 25, 2006 - 4:57 AM

There is an exception in m_wndMenuBar.Create(NULL, this, ID_VIEW_MENUBAR) when in OLE Object insertion.

When I try to insert my OLE Document in word, I have problem.

It is difficult to trace the problem, but it seems to be in:

int CExtMenuControlBarXD::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
….
….
….
// pass message loop for smooth MDI client area update reasons
CExtPopupMenuWnd::PassMsgLoop( CExtControlBar::g_bEnableOnIdleCalls );
return 0;
}

If I call CExtPopupMenuWnd::PassMsgLoop( CExtControlBar::g_bEnableOnIdleCalls ) I have the problem
If I comment the line, I don’t have the problem.

My analyse is that PassMsgLoop dispatch pending OLE message to create Document…
But CMainFrame is not yet created, AfxGetThread()->m_pMainWnd is still NULL.

Does someone experience that?
Could someone help me?

There is a suspect message 0x400? WM_USER or DM_GETDEFID ?

My work around is:

AfxGetThread()->m_pMainWnd = this;
if(!m_wndMenuBar.Create(NULL, this, ID_VIEW_MENUBAR))
...

Technical Support Sep 26, 2006 - 11:46 AM

The problem may be with the InitInstance() virtual method of the CWinApp-derived class in your project. Here is the best design of how this method should create the main frame window:

CMainFrame* pFrame = new CMainFrame;
    m_pMainWnd = pFrame;
    if( ! pFrame->LoadFrame( . . . ) )
    {
        m_pMainWnd = NULL;
        return FALSE;
    }


Here is the variant of how it looks in MFC applications, which is not the best:
CMainFrame* pFrame = new CMainFrame;
    if( ! pFrame->LoadFrame( . . . ) )
        return FALSE;
    m_pMainWnd = pFrame;