Getting Context Menu Information

From: Jamie S (creamer72_at_hotmail.com)
Date: 07/16/04


Date: 16 Jul 2004 04:18:00 -0700

Hi,

Ive overridden the context menu and want to gain the URL, when a user
right clicks on a link (anchor).
However, although my code compiles fine, it crashes when
right-clicking on a link. I have narrowed the problem to my
queryinterface line. Has anyone got an idea of where i went wrong?
Thanks.

HRESULT FAR EXPORT CCustomControlSite::XDocHostUIHandler::ShowContextMenu(
                                DWORD dwID,
                                POINT* /*pptPosition*/,
                                IUnknown* /*pCommandTarget*/,
                                IDispatch *pdispReserved)
{
        METHOD_PROLOGUE(CCustomControlSite, DocHostUIHandler)

        if (dwID == 6) //an anchor (works fine)
        {
                IHTMLAnchorElement *pElem = NULL;
                BSTR bstrURL;
                
pdispReserved->QueryInterface(IID_IHTMLAnchorElement,(void**)&pElem);
        
                 pElem->get_href(&bstrURL);

        }
                else
                AfxMessageBox("Default Menu");
        
return S_OK;
}



Relevant Pages

  • Re: Development Advice
    ... > a cost to try and avoid the "Kick the wall 1000x to gain Master Ninja" ... kicking a wall trains kicking in the context of walls. ...
    (rec.games.roguelike.development)
  • Re: a name vs. span id?
    ... What is the context of the question? ... I was viewing the HTML source of some webpage, ... All the webpages / webapps I've worked, thus far, on have used anchor ...
    (comp.infosystems.www.authoring.html)
  • Re: CDialog contructor with nIDTemplate
    ... You are suggesting that you are doing this in a DLL. ... There is not enough context here ot answer the question. ... The code compiles ... But the m_lpszTemplateName remains null in the constructor and hence ...
    (microsoft.public.vc.mfc)
  • Re: why is a DI not a pre?
    ... A "Preamp" as we understand the term in the context of ... audio devices is a box or a circuit within a box that performs a ... and that function is to provide positive gain. ...
    (rec.audio.pro)
  • Re: AVID NDxHD
    ... Anchor wrote: ... > Is AVID NDxHD lossless? ... But in case someone wants to help, I thought I'd provide some context. ... Prev by Date: ...
    (comp.compression)