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

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


OLE-control container in an SDI dialog-based app

Sundar Narasimhan -- sundar@ascent.com
Sunday, March 23, 1997

Environment: VC++ 4.2b, NT 4.0
Hi, The documented ways of getting a control within a container only
seem to address the problem of getting a control through DDX_Control
(inside a dialog) or instantiating the control manually through Create().

What's the correct way of getting such functionality in a CFormView
derived SDI app where the control has been inserted in a Dialog. Our
attempts with GetDlgItem() etc. seem to return a CWnd but one who's
control site is not properly hooked up?

What are we missing?

Thanks.



mzinner@berlin.snafu.de
Wednesday, March 26, 1997

MFC is using 2 CWnd's to represent the control. One is on the server 
side, the other on the client side. There is only one windows window 
and one HWND, though, which is shared by both CWnd's.

When calling GetDlgItem, you get the client side's CWnd pointer. You 
can use that dlgItemWnd->m_hWnd, it's your controls window handle. Or, you 
could use dlgItemWnd->GetControlUnknown() to get any interface of 
your control.

>What's the correct way of getting such functionality in a CFormView
>derived SDI app where the control has been inserted in a Dialog. Our
>attempts with GetDlgItem() etc. seem to return a CWnd but one who's
>control site is not properly hooked up?




Become an MFC-L member | Вернуться в корень Архива |