Board index » cppbuilder » Accessing activeX an control's container

Accessing activeX an control's container

hi,

how do I access the application using my activeX control from withing the
activeX control?  More specifically -- how do i access Internet Explorer's
object model from within an activeX control?  There is a description of how
do do this on the MSDN website, but it seems to be for Visual C++, does
anyone know how to do this in Borland?

thanks,
Brian

 

Re:Accessing activeX an control's container


  The code below is from an ActiveForm called TTSL_Default
  parentThis is a void pointer to the parent (TTSL_DefaultImpl - the
actual activeX object). If you are working with on ActiveX only (ie
not an ActiveForm) then it will require some modification.

   IOleObject *p;
   IOleContainer * ioc;
   IOleClientSite * cs;
   IHTMLWindow2 * theWindow;
   IHTMLDocument2 * theDoc;

if(SUCCEEDED(((TTSL_DefaultImpl*)parentThis)->QueryInterface(IID_IOleO
bject, (LPVOID*) &p))
   && (p!=0))     // getting the OleObject  for the ActiveForm.
                          // for straight OleObject you may be able to
use "this" pointer instead of p. (?)
   if(SUCCEEDED(p->GetClientSite(&cs)) && (cs != 0))
   if(SUCCEEDED(cs->GetContainer(&ioc)) && (ioc != 0))
   if(SUCCEEDED(ioc->QueryInterface(IID_IHTMLDocument2, (LPVOID*) &
theDoc))
   && (theDoc != 0))
   {

     theDoc->get_parentWindow(&theWindow);
     // now can do stuff with the document and window

   }
   if(theWindow!= 0) theWindow->Release();
   if(theDoc!= 0) theWindow->Release();
   if(ioc != 0) ioc->Release();
   if(cs != 0) cs->Release();
   if(p != 0) p->Release();

Quote
"Brian Olson" <bol...@princeton.edu> wrote in message

news:3dd8dd67$2@newsgroups.borland.com...
Quote
> hi,

> how do I access the application using my activeX control from
withing the
> activeX control?  More specifically -- how do i access Internet
Explorer's
> object model from within an activeX control?  There is a description
of how
> do do this on the MSDN website, but it seems to be for Visual C++,
does
> anyone know how to do this in Borland?

> thanks,
> Brian

Other Threads