Solved

ActiveX and HTML

Posted on 2006-07-13
3
234 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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

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…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
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 viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

762 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

18 Experts available now in Live!

Get 1:1 Help Now