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. ATL / WTL / STL
  4. ATL & DHTML

ATL & DHTML

Scheduled Pinned Locked Moved ATL / WTL / STL
c++htmlhelp
1 Posts 1 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.
  • L Offline
    L Offline
    Leesen
    wrote on last edited by
    #1

    I write an ATL control to implement the OnUnLoad event of the html. I set the OnUnload handle through IHTMLBodyElement. But it did not work. Source code as follow: //definition of IDHTMLTest2 in IDL interface IDHTMLTest2 : IDispatch { [id(1), helpstring("method ShowMsg")] HRESULT ShowMsg(); }; //selection of the source code CComPtrspIE; m_spClientSite->GetContainer(&spIE); CComQIPtrspDoc(spIE); if (spDoc){ CComPtr spElement; spDoc->get_body(&spElement); CComQIPtr spBody(spElement); IDispatch* pShowMsg; QueryInterface(IID_IDHTMLTest2,(void**)&pShowMsg); VARIANT v; v.vt=VT_DISPATCH; v.pdispVal=pShowMsg; //this event can't be invoke ,when close the ie-window spBody->put_onunload(v); //this invoke works well ((IDHTMLTest2*)pShowMsg)->ShowMsg(); //code below can works well // v.vt=VT_BSTR; // v.bstrVal = L"#DA70D6"; // spBody->put_bgColor(v); } Thank you for your advanced help. Regards.

    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