Click here to Skip to main content
15,896,111 members

ActiveX Control , Com and overlaped child windows

Argonia asked:

Open original thread
Hello again,
I have a problem with ActiveX control. 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 ActiveX control
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:)

One more question: is it possible to send a message to the COM object for example minimize so it can minimize the floating windows when minimize button on the dialog is pressed?

Update: After using Spy++ (VS utility) i found that normally when one window is docket its child of some window which is child of the dialog itself. The problem is when some window is floating it is no longer a child of the Dialog(grandchild)
Tags: C++, ATL, COM

Plain Text
ASM
ASP
ASP.NET
BASIC
BAT
C#
C++
COBOL
CoffeeScript
CSS
Dart
dbase
F#
FORTRAN
HTML
Java
Javascript
Kotlin
Lua
MIDL
MSIL
ObjectiveC
Pascal
PERL
PHP
PowerShell
Python
Razor
Ruby
Scala
Shell
SLN
SQL
Swift
T4
Terminal
TypeScript
VB
VBScript
XML
YAML

Preview



When answering a question please:
  1. Read the question carefully.
  2. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  3. If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
  4. Don't tell someone to read the manual. Chances are they have and don't get it. Provide an answer or move on to the next question.
Let's work to help developers, not make them feel stupid.
Please note that all posts will be submitted under the http://www.codeproject.com/info/cpol10.aspx.



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900