15 мая 2023 года "Исходники.РУ" отмечают своё 23-летие!
Поздравляем всех причастных и неравнодушных с этим событием!
И огромное спасибо всем, кто был и остаётся с нами все эти годы!

Главная Форум Журнал Wiki DRKB Discuz!ML Помощь проекту


Get Parent Iunknown

Frank -- FMEYER@INTEGRAL.MHS.CompuServe.COM
Wednesday, May 08, 1996


We are placing an OCX onto another OCX as a child window. We need to get the 
parents Iunknown or Idispatch.

Writing VBX's this was possible because form the parents HWND we could get 
the parents HCTL and hence the known properties.

We are writing OCX's and have failed to get the parents iunknown due to the 
fact that the GetParent call is creating a temporary CWnd.

Basically with any window how do you determine the whether it has an 
Iunknown interface and get it's pointer??????????????????


Help

Thanks


Frank Meyer/Raj Mal







Randal Parsons -- Randal.Parsons@btal.com.au
Friday, May 10, 1996

Meyer, Frank wrote:
> 
> We are placing an OCX onto another OCX as a child window. We need to get the
> parents Iunknown or Idispatch.
> 
> Writing VBX's this was possible because form the parents HWND we could get
> the parents HCTL and hence the known properties.
> 
> We are writing OCX's and have failed to get the parents iunknown due to the
> fact that the GetParent call is creating a temporary CWnd.
> 
> Basically with any window how do you determine the whether it has an
> Iunknown interface and get it's pointer??????????????????
> 

I'm not totally sure that this will work, but here's a code fragment that may 
be helpful :

// I use this code to get the owner of a control so that I can create its
// property dialog when I want.
CWnd*		pWnd = GetParent();
HWND		hWndParent = (pWnd ? pWnd->GetSafeHwnd() : 0);
CWnd*		pWndOwner = CWnd::GetSafeOwner(CWnd::FromHandle(hWndParent));

// I guess you can do this
LPUNKNOWN	pUnk = (pWndOwner ? pWndOwner->GetIDispatch(FALSE) : 0);

The first section of code is a slightly modified form of code I found in
	http://www.sky.net/~toma/faq.htm
which is an OLE Controls FAQ.

Regards,

Randal Parsons.




| Вернуться в корень Архива |