AfxHookWindowCreate problem with activex object on windows form

G

Guest

hello fellow programmers,

can anyone help me with the following problem. I have a activex control
embedded on a windows form in C#. When I make the form an mdichild of the
parent application, I get an exception in wincore.cpp on line 626. If the
form is neither modal or a child, the is no problem, the form displays and
the control is functional. However, if I settle for this, the form will not
be inside the application frames container, and just will float on the
desktop. Below I have attached the wincore.cpp code where the failure occurs.
It occurs on the following statement:
"ASSERT(pThreadState->m_hHookOldCbtFilter != NULL); ". When I try to debug,
managed code will not allow me to step into the interop.activex.dll. How do
I solve this?


void AFXAPI AfxHookWindowCreate(CWnd* pWnd)
{
_AFX_THREAD_STATE* pThreadState = _afxThreadState.GetData();
if (pThreadState->m_pWndInit == pWnd)
return;

if (pThreadState->m_hHookOldCbtFilter == NULL)
{
pThreadState->m_hHookOldCbtFilter = ::SetWindowsHookEx(WH_CBT,
_AfxCbtFilterHook, NULL, ::GetCurrentThreadId());
if (pThreadState->m_hHookOldCbtFilter == NULL)
AfxThrowMemoryException();
}
ASSERT(pThreadState->m_hHookOldCbtFilter != NULL);
ASSERT(pWnd != NULL);
ASSERT(pWnd->m_hWnd == NULL); // only do once

ASSERT(pThreadState->m_pWndInit == NULL); // hook not already in progress
pThreadState->m_pWndInit = pWnd;
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top