Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Getting Events from an embedded HTML viewer control

Getting Events from an embedded HTML viewer control

Scheduled Pinned Locked Moved C / C++ / MFC
c++questionhtmlwindows-adminlinux
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    Dave Calkins
    wrote on last edited by
    #1

    We have a native Visual C++/MFC app, and have a dialog which contains a web browser control. The web browser control is a CWnd-derived class which uses InvokeHelper to communicate with the browser control. We call Navigate2() to send it to a URL and display the HTML in a child window within our dialog. This works great. The question is how do we go about handling HTML events in the containing C++ dialog? For example, suppose we have a button in the displayed HTML which has an onclick event handler. We'd like the user to be able to click on the button in the HTML and have the containing MFC dialog get the event. How do we communicate events out to the containing dialog? The specifics of the control we're using are below. This is whats in the registry under the CLSID referenced in the wrapper class. Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\CLSID\{8856F961-340A-11D0-A96B-00C04FD705A2}] @="Microsoft Web Browser" [HKEY_CLASSES_ROOT\CLSID\{8856F961-340A-11D0-A96B-00C04FD705A2}\Control] @="" [HKEY_CLASSES_ROOT\CLSID\{8856F961-340A-11D0-A96B-00C04FD705A2}\InProcServer32] @="C:\\WINDOWS\\system32\\ieframe.dll" "ThreadingModel"="Apartment" [HKEY_CLASSES_ROOT\CLSID\{8856F961-340A-11D0-A96B-00C04FD705A2}\MiscStatus] @="0" [HKEY_CLASSES_ROOT\CLSID\{8856F961-340A-11D0-A96B-00C04FD705A2}\MiscStatus\1] @="131473" [HKEY_CLASSES_ROOT\CLSID\{8856F961-340A-11D0-A96B-00C04FD705A2}\ProgID] @="Shell.Explorer.2" [HKEY_CLASSES_ROOT\CLSID\{8856F961-340A-11D0-A96B-00C04FD705A2}\ToolboxBitmap32] @="C:\\WINDOWS\\system32\\ieframe.dll, 257" [HKEY_CLASSES_ROOT\CLSID\{8856F961-340A-11D0-A96B-00C04FD705A2}\TypeLib] @="{EAB22AC0-30C1-11CF-A7EB-0000C05BAE0B}" [HKEY_CLASSES_ROOT\CLSID\{8856F961-340A-11D0-A96B-00C04FD705A2}\Version] @="1.1" [HKEY_CLASSES_ROOT\CLSID\{8856F961-340A-11D0-A96B-00C04FD705A2}\VersionIndependentProgID] @="Shell.Explorer"

    L P 2 Replies Last reply
    0
    • D Dave Calkins

      We have a native Visual C++/MFC app, and have a dialog which contains a web browser control. The web browser control is a CWnd-derived class which uses InvokeHelper to communicate with the browser control. We call Navigate2() to send it to a URL and display the HTML in a child window within our dialog. This works great. The question is how do we go about handling HTML events in the containing C++ dialog? For example, suppose we have a button in the displayed HTML which has an onclick event handler. We'd like the user to be able to click on the button in the HTML and have the containing MFC dialog get the event. How do we communicate events out to the containing dialog? The specifics of the control we're using are below. This is whats in the registry under the CLSID referenced in the wrapper class. Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\CLSID\{8856F961-340A-11D0-A96B-00C04FD705A2}] @="Microsoft Web Browser" [HKEY_CLASSES_ROOT\CLSID\{8856F961-340A-11D0-A96B-00C04FD705A2}\Control] @="" [HKEY_CLASSES_ROOT\CLSID\{8856F961-340A-11D0-A96B-00C04FD705A2}\InProcServer32] @="C:\\WINDOWS\\system32\\ieframe.dll" "ThreadingModel"="Apartment" [HKEY_CLASSES_ROOT\CLSID\{8856F961-340A-11D0-A96B-00C04FD705A2}\MiscStatus] @="0" [HKEY_CLASSES_ROOT\CLSID\{8856F961-340A-11D0-A96B-00C04FD705A2}\MiscStatus\1] @="131473" [HKEY_CLASSES_ROOT\CLSID\{8856F961-340A-11D0-A96B-00C04FD705A2}\ProgID] @="Shell.Explorer.2" [HKEY_CLASSES_ROOT\CLSID\{8856F961-340A-11D0-A96B-00C04FD705A2}\ToolboxBitmap32] @="C:\\WINDOWS\\system32\\ieframe.dll, 257" [HKEY_CLASSES_ROOT\CLSID\{8856F961-340A-11D0-A96B-00C04FD705A2}\TypeLib] @="{EAB22AC0-30C1-11CF-A7EB-0000C05BAE0B}" [HKEY_CLASSES_ROOT\CLSID\{8856F961-340A-11D0-A96B-00C04FD705A2}\Version] @="1.1" [HKEY_CLASSES_ROOT\CLSID\{8856F961-340A-11D0-A96B-00C04FD705A2}\VersionIndependentProgID] @="Shell.Explorer"

      L Offline
      L Offline
      led mike
      wrote on last edited by
      #2

      Dave Calkins wrote:

      We have a native Visual C++/MFC app, and have a dialog which contains a web browser control.

      So you did not use the CDHtmlDialog MFC class[^]? Why not?

      D 1 Reply Last reply
      0
      • L led mike

        Dave Calkins wrote:

        We have a native Visual C++/MFC app, and have a dialog which contains a web browser control.

        So you did not use the CDHtmlDialog MFC class[^]? Why not?

        D Offline
        D Offline
        Dave Calkins
        wrote on last edited by
        #3

        I'm adding this to an existing dialog. I don't want the entire dialog to be HTML. I want to have regular controls on the dialog and then have one area of the dialog display HTML content.

        L 1 Reply Last reply
        0
        • D Dave Calkins

          I'm adding this to an existing dialog. I don't want the entire dialog to be HTML. I want to have regular controls on the dialog and then have one area of the dialog display HTML content.

          L Offline
          L Offline
          led mike
          wrote on last edited by
          #4

          Then it sounds like your going to have to dig into the large set of documentation for using the Web Browser Control[^]. You will have to re-implement some of the features that are in CDHtmlDialog to accomplish your stated objective.

          1 Reply Last reply
          0
          • D Dave Calkins

            We have a native Visual C++/MFC app, and have a dialog which contains a web browser control. The web browser control is a CWnd-derived class which uses InvokeHelper to communicate with the browser control. We call Navigate2() to send it to a URL and display the HTML in a child window within our dialog. This works great. The question is how do we go about handling HTML events in the containing C++ dialog? For example, suppose we have a button in the displayed HTML which has an onclick event handler. We'd like the user to be able to click on the button in the HTML and have the containing MFC dialog get the event. How do we communicate events out to the containing dialog? The specifics of the control we're using are below. This is whats in the registry under the CLSID referenced in the wrapper class. Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\CLSID\{8856F961-340A-11D0-A96B-00C04FD705A2}] @="Microsoft Web Browser" [HKEY_CLASSES_ROOT\CLSID\{8856F961-340A-11D0-A96B-00C04FD705A2}\Control] @="" [HKEY_CLASSES_ROOT\CLSID\{8856F961-340A-11D0-A96B-00C04FD705A2}\InProcServer32] @="C:\\WINDOWS\\system32\\ieframe.dll" "ThreadingModel"="Apartment" [HKEY_CLASSES_ROOT\CLSID\{8856F961-340A-11D0-A96B-00C04FD705A2}\MiscStatus] @="0" [HKEY_CLASSES_ROOT\CLSID\{8856F961-340A-11D0-A96B-00C04FD705A2}\MiscStatus\1] @="131473" [HKEY_CLASSES_ROOT\CLSID\{8856F961-340A-11D0-A96B-00C04FD705A2}\ProgID] @="Shell.Explorer.2" [HKEY_CLASSES_ROOT\CLSID\{8856F961-340A-11D0-A96B-00C04FD705A2}\ToolboxBitmap32] @="C:\\WINDOWS\\system32\\ieframe.dll, 257" [HKEY_CLASSES_ROOT\CLSID\{8856F961-340A-11D0-A96B-00C04FD705A2}\TypeLib] @="{EAB22AC0-30C1-11CF-A7EB-0000C05BAE0B}" [HKEY_CLASSES_ROOT\CLSID\{8856F961-340A-11D0-A96B-00C04FD705A2}\Version] @="1.1" [HKEY_CLASSES_ROOT\CLSID\{8856F961-340A-11D0-A96B-00C04FD705A2}\VersionIndependentProgID] @="Shell.Explorer"

            P Offline
            P Offline
            Paresh Chitte
            wrote on last edited by
            #5

            Hi Dave, Couple of months ago, I was also in search for a solution to this problem. http://www.codeproject.com/script/Forums/View.aspx?fid=1647&msg=2020089[^] http://www.codeguru.com/forum/showthread.php?t=422673[^]. Could you please share the solution if you find any ? Regards, Paresh.

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups