Solved

ActiveX and HTML

Posted on 2006-07-13
3
236 Views
Last Modified: 2013-11-18
hi,

I am new in ActiveX developing. So there is the question:

Can my ActiveX control navigate browser window it is in?
example:
I have an ActiveX control that is similar to button, I add it to the html page as an object. When I press that control, it should set new location for the window it is in.
I know that I can use ShellExecute in my ActiveX to open a html page, but how should I set the appropriate window?

hope that you will get the problem from this description
Thank you for your time
Giedrius
0
Comment
Question by:GiedriusS
3 Comments
 
LVL 8

Accepted Solution

by:
mrblue earned 125 total points
ID: 17190694
"Can my ActiveX control navigate browser window it is in?"

Yes. ActiveX control is in container and it can be queried (QueryService() method) of some offered services.
Note it (below) is specific to IE.

Please take a look at it (I think this is what you need):

http://www.experts-exchange.com/Programming/Programming_Languages/Cplusplus/Q_21860252.html

There's a piece of code in ActiveX control implementation that accesses IE:

===================
[...]
     STDMETHOD(SetClientSite)(IOleClientSite *pClientSite)
     {
          if(pClientSite != NULL) {
               HRESULT hRes;

               hRes = pClientSite->QueryInterface(IID_IServiceProvider, (void **)&m_pIServiceProvider);

               if(SUCCEEDED(hRes)) {
                    hRes = m_pIServiceProvider->QueryService(IID_IWebBrowserApp, IID_IWebBrowser2, (void **)&m_pIWebBrowser);
               };
          };

          return IOleObject_SetClientSite(pClientSite);
     }
private:
     CComPtr<IServiceProvider> m_pIServiceProvider;
     CComPtr<IWebBrowser2> m_pIWebBrowser;
};
=========================

There was a problem with using it from popup window but from regular window it works very well.

"IWebBrowser" is interface that controls IE from within ActiveX control (documentation in MSDN).


0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
Before we dive into the marketing strategies involved with creating an effective homepage, it’s crucial that EE members know what a homepage is. In essence, a homepage is the introductory, or default page, of a website that typically highlights the …
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now