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. ATL / WTL / STL
  4. How to monitor ie events via toolbar without mfc

How to monitor ie events via toolbar without mfc

Scheduled Pinned Locked Moved ATL / WTL / STL
c++comhelpquestion
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
    shivditya
    wrote on last edited by
    #1

    I found only one article on codeproject is using CCmdTarget for finding sink for AfxConnectionAdvise((LPUNKNOWN)s_pFrameWB,DIID_DWebBrowserEvents2,pUnk,FALSE,dw); I know that I have to use interface DWebBrowserEvents2. But for which It requires CCmdTarget,which is mfc class. I am trying to monitor IE with help of toolbar, so I am using pure atl,com and not mfc.So what is alternative way to monitor events.I have IWebBrowser2 object in my hand.

    || ART OF LIVING ||

    S 1 Reply Last reply
    0
    • S shivditya

      I found only one article on codeproject is using CCmdTarget for finding sink for AfxConnectionAdvise((LPUNKNOWN)s_pFrameWB,DIID_DWebBrowserEvents2,pUnk,FALSE,dw); I know that I have to use interface DWebBrowserEvents2. But for which It requires CCmdTarget,which is mfc class. I am trying to monitor IE with help of toolbar, so I am using pure atl,com and not mfc.So what is alternative way to monitor events.I have IWebBrowser2 object in my hand.

      || ART OF LIVING ||

      S Offline
      S Offline
      Stuart Dootson
      wrote on last edited by
      #2

      To handle those events in ATL, you need to derive a class from IDispEventImpl and add a sink map handling the events you want. Here's some incomplete code that handles mouse over and mouse out events from a browser window embedded as a control:

      class MyView : public CWindowImpl<MyView, CAxWindow>,
                     public IDispEventImpl<1, MyView, &DIID_HTMLElementEvents2, &LIBID_MSHTML, 4, 0>
      {
      public:
         typedef IDispEventImpl<1, MyView, &DIID_HTMLElementEvents2, &LIBID_MSHTML, 4, 0> HTMLElementEventsSink;
      
         BEGIN_SINK_MAP(MyView)
            SINK_ENTRY_EX(1, DIID_HTMLElementEvents2, DISPID_HTMLELEMENTEVENTS_ONMOUSEOVER, OnMouseOver)
            SINK_ENTRY_EX(1, DIID_HTMLElementEvents2, DISPID_HTMLELEMENTEVENTS_ONMOUSEOUT, OnMouseOut)
         END_SINK_MAP()
      
         BEGIN_MSG_MAP_EX(MyView)
            MESSAGE_HANDLER(WM_CREATE, OnCreate)
            MESSAGE_HANDLER(WM_DESTROY, OnDestroy)
         END_MSG_MAP()
      private:
      

      You'll need to call HTMLElementEventsSink::DispEventAdvise to tell IE that you want to handle the events, using an appropriate IDispatch pointer to say which objects events you want.

      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