[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

How to control IE WebBrowser Control from an ActiveX control inside it?

Posted on 1998-11-10
4
Medium Priority
?
308 Views
Last Modified: 2013-11-20
 I create an ActiveX Control,and use it inside IE WebBrowser Control, my question is how to control the IE WebBrowser Control.
  I can get the IE WebBrowser Control Wnd by call the function FindWindow(), but I cann't get IUnknown Pointer to the Control.
  Can anyone help me?
  Thank you!
0
Comment
Question by:linyf
[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
  • 2
  • 2
4 Comments
 
LVL 1

Accepted Solution

by:
fstab earned 100 total points
ID: 1324493
By doing a QueryInterface on your control, and if this is successful, you should be able to get to the IUnknown pointer too, by doing one more QueryInterface to IUnknown. This is because of one of the rules of COM : when you can get from here to there, you can get from there to anywhere.
0
 

Author Comment

by:linyf
ID: 1324494
Thank you!
    But how can I get the IUnknown pointer?
    I used this way to get the IE WebBrowser Control that contains my control:

    CWnd * tWnd=GetParent();
    while(tWnd)
    {
      GCHAR tClassName[255];
      strcpy(tClassName,"");
      GetClassName(tWnd->m_hWnd,tClassName,250);
      if(strcmp(tClassName,"Internet Explorer_Server")==0)
      {
      }
      tWnd=tWnd->GetParent();
    }

    How can I get an IUnknown pointer through the tWnd Object?
    Or there exists other way to do this?

0
 
LVL 1

Expert Comment

by:fstab
ID: 1324495
You cannot get the IUnknown from the window handle.

The definition of QueryInterface is as follows :

HRESULT QueryInterface(
  REFIID iid,        //Identifier of the requested interface
  void ** ppvObject  //Address of output variable that receives the
                     //interface pointer requested in iid);

Do the following steps :

1. Open your system's Windows Registry - run regedit.
2. Open HKEY_CLASSES_ROOT
3. Search for the IE WebBrowser control entry - it'll usually be in the format : Vendor.Control.Version
4. Note this name down : for eg. MS***.WebBrowser.2
5. Use the function CLSIDtoProgID which returns the CLSID of this control
6. Use the CLSID returned from this function to QueryInterface

Good luck !
fstab.
0
 

Author Comment

by:linyf
ID: 1324496
Thank you very much!

    I know how to create an IE WebBrowser Control,but what I want to do is to seek for an existing WebBrowser Control that contains my own ActiveX control (because inside my control I want to call such methods as "Navigate","GoBack" and so on.),
I know CWnd class has a method called GetControlUnknown() for getting an IUnknown pointer of an OleControl,that is why I want to get an IUnknown pointer from a CWnd object. If this way is not possible, can you tell me other ways?
    Thank you again!

0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
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…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Suggested Courses

656 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