Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

ActiveX and HTML

Posted on 2006-07-13
3
Medium Priority
?
255 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
1 Comment
 
LVL 8

Accepted Solution

by:
mrblue earned 500 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
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++.
Suggested Courses

782 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