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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. How can i capture an event from HTML page in my application

How can i capture an event from HTML page in my application

Scheduled Pinned Locked Moved C / C++ / MFC
questionc++htmlhostinghelp
2 Posts 2 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.
  • S Offline
    S Offline
    sujeet
    wrote on last edited by
    #1

    I have a MFC dialog based applicaton in which i am hosting a web browser. I want to capture any mouse click event in the HTML file contained inside this web browser in my application. Can anyone please help? Thanks, Sujeet

    M 1 Reply Last reply
    0
    • S sujeet

      I have a MFC dialog based applicaton in which i am hosting a web browser. I want to capture any mouse click event in the HTML file contained inside this web browser in my application. Can anyone please help? Thanks, Sujeet

      M Offline
      M Offline
      Matthew Faithfull
      wrote on last edited by
      #2

      It can be done but the only way I know of is quite hard. First you need to make sure there is a script, Javascript or VBscript, in or linked to whatever page is in the browser, that must have an onclick handler for the <body> tag. This gets the click from the mouse into script. Now you need to poke around in the Document Object Model of the WebBrowser control to determine how to access the Window object, or equivalent. This will have a mechanism for raising an event to it's parent. I'm afraid I've forgotten exactly how this works but it will end up with an ActiveX event being raised to your dialog. This means of course your dialog needs to be a fully fledged ActiveX control container with the relevent event handler. That in itself is pretty complex but ATL/WTL can do most of it for you. Considering the amount of work this all is, unless you've got most of it in place already you might want to find another way, perhaps do all the click handling in script within the browser.

      Nothing is exactly what it seems but everything with seems can be unpicked.

      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