Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Access windows form application from ActiveX control

6 views
Skip to first unread message

R.Berndt

unread,
Feb 11, 2010, 10:18:22 AM2/11/10
to
Hi,

I've created an MFC ActiveX control (COleControl). This control is
embedded within a Windows Forms Application (C#). Is there a way to
access methods or attributes of the form hosting the ActiveX control
from the control?

If the control is hosted within the IE I was able to access it with:
...
LPOLECLIENTSITE pClientSite = this->GetClientSite();
...
pClientSite->GetContainer( &pContainer );
...
pContainer->QueryInterface( IID_IHTMLDocument2,(void**) &pDoc );

But I'm totally puzzled which interface to use when the control is
hosting in a form.


Thanks in advance

cheers
Renᅵ

Sheng Jiang [MVP]

unread,
Mar 4, 2010, 5:33:49 PM3/4/10
to
It is generally not a good idea, you have on idea if the form is hosted in
Visual Studio, in IE or in some other container. If you have control over
the windows froms app, why not raise an event and pass command code, then
carry out commands in your winform app's event handler?


"R.Berndt" <r.be...@cgv.tugraz.at> wrote in message
news:eZta01yq...@TK2MSFTNGP04.phx.gbl...

0 new messages