Solved

ActiveX and HTML

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to programmatically differentiate between C and Java 10 221
C++ Language error 28 314
thread-safe code in c++ 2 128
C++ error cannot convert from std::string to const char * 6 367
Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
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 goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…

738 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