?
Solved

ActiveX and HTML

Posted on 2006-07-13
3
Medium Priority
?
252 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
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: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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 the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
The purpose of this video is to demonstrate how to set up the WordPress backend so that each page automatically generates a Mailchimp signup form in the sidebar. This will be demonstrated using a Windows 8 PC. Tools Used are Photoshop, Awesome…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…

719 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