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 - amidoinitrite?

IObjectWithSite - amidoinitrite?

Scheduled Pinned Locked Moved COM
helpc++sharepointlinuxquestion
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.
  • T Offline
    T Offline
    T800G
    wrote on last edited by
    #1

    I'm trying to do this error-free. I'm writing context menu shell extension that will navigate current Explorer window through IShellBrowser acquired through IObjectWithSite and so far I have this (omitting unimportant code): header file

    class ATL_NO_VTABLE CShellTarget :
    public CComObjectRootEx<CComSingleThreadModel>,
    public CComCoClass<CShellTarget,&CLSID_ShellTarget>,
    public IShellExtInit,
    public IContextMenu,
    public IObjectWithSiteImpl<CShellTarget>
    ...
    private:
    CComPtr<IShellBrowser> m_pShellBrowser;
    ...
    };

    and here I override SetSite method, but I'm not sure if this code is OK

    HRESULT CShellTarget::SetSite(IUnknown *pUnkSite)
    {
    ATLTRACE("IObjectWithSiteImpl::SetSite\n");

    IObjectWithSiteImpl<CShellTarget>::SetSite(pUnkSite);
    
    if (m\_spUnkSite!=NULL)
    {
    	CComQIPtr<IServiceProvider>; sp = pUnkSite;
    	sp->QueryService(SID\_SShellBrowser,IID\_IShellBrowser,(void\*\*)&m\_pShellBrowser);
    	//verify m\_pShellBrowser etc...
    }
    else m\_pShellBrowser.Release();
    

    return S_OK;
    }

    It's hard to find one representative code sample of IObjectWithSite and Google isn't that much helpful. (btw yea I know about WM_GETISHELLBROWSER hack) Help is appreciated.

    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