Click here to Skip to main content
15,894,405 members

ATL Control Containment, Com and overlaped child windows

Revision 1
Hello again,
I have a problem with ATL Control Containments. I have a com (written in c#) which is a frame with few child windows. I made a c++ app which calls the COM object in a Dialog via ATL Control Containment
C++
BOOL (WINAPI *m_AtlAxWinInit)();
	m_AtlAxWinInit = (BOOL (WINAPI *)(void))::GetProcAddress(hWebLib, "AtlAxWinInit");
    m_AtlAxWinInit();

	// Get the bounds for the activeX control 
	CRect rect;
	m_ActiveXarea.GetWindowRect(&rect);
	
	hAtl = ::CreateWindowEx(
			WS_EX_DLGMODALFRAME/*| WS_CLIPSIBLINGS*/, \
			TEXT("AtlAxWin"),\
			strActiveXName,\
			WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_EX_RTLREADING,\
			rect.left, rect.top, rect.right-rect.left, rect.bottom-rect.top,\
			hSelf,\
			NULL,\
			NULL,\
			NULL);
	
	if (!hAtl)
	{
		::MessageBox( NULL, TEXT("Can not load AtlAxWin!"), TEXT("Caption"), MB_OK | MB_ICONSTOP);
		throw int(106901);
	}

	HRESULT (WINAPI *m_AtlAxGetControl) (HWND h, IUnknown** pp);
	m_AtlAxGetControl = (HRESULT (WINAPI *) (HWND, IUnknown**))::GetProcAddress(hWebLib, "AtlAxGetControl");

	m_AtlAxGetControl(hAtl, &pUnk);
	HRESULT res = pUnk->QueryInterface(IID_Control,(LPVOID *) &pFunLineViewer);


This code is taken from this article How to Integrate C# Window in C++ Project

The problem i am facing is that when i undock one of the child windows from the COM Object and click on the Dialog (or the frame itself outside of the floating window ),the Dialog overlaps the floating child window

I tried with WS_CLIPCHILDREN, WS_CLIPSIBLINGS, SetWindowPos on the dialog and on the new HWND hAtl which contains the COM Object but nothing seems to work
If you have some more ideas or suggestions what to do please tell me:)

Some tutorials on ATL Control Containments or ATL itself, are welcome and some references to books too.(i haven't work with ATL before)
Posted 8-Oct-12 3:07am by Argonia.
Tags: , ,