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. COM
  4. IObjectWithSite and IOLECommandTarget Problem

IObjectWithSite and IOLECommandTarget Problem

Scheduled Pinned Locked Moved COM
helpcsharpcomwindows-admin
1 Posts 1 Posters 1 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.
  • J Offline
    J Offline
    jlittlet
    wrote on last edited by
    #1

    Greetings, I am building a VB.NET dll to respond to the click event of a custom button added to IE's toolbar. In response to the button click the .dll will print the current page to a specific printer without the user needing to choose it from the print dialog. I am implementing the IObjectWithSite interface to handle acquiring a reference to the browser. And I am implementing the IOLECommandTarget interface in order to receive the click notification via the Exec method. If I set up the registry entries under "Browser Helper Objects" my .dll is being properly instantiated by IE when it loads, and I am successfully acquiring a reference to the browser with "wb = CType(pUnkSite, SHDocVw.IWebBroswer2)" in the SetSite method of IObjectWithSite. However, upon clicking the custom toolbar button, the SetSite method is apparently called again, and I encounter the following error when attempting to acquire the broswer reference: Unable to cast COM object of type 'System.__ComObject' to interface type 'SHDocVw.IWebBrowser2'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{D30C1661-CDAF-11D0-8A3E-00C04FC9E26E}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)). Any ideas on why this is happening? Thanks

    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