Click to return to the Reusing Browser Technology home page    
IDocHostUIHandler::Resize...     IDocHostUIHandler::ShowUI...     IDocHostUIHandler Interfa...    
Web Workshop  |  Reusing Browser Technology

IDocHostUIHandler::ShowContextMenu Method


Called from MSHTML to display a context menu.

Syntax

HRESULT ShowContextMenu( 
    DWORD dwID,
    POINT FAR *ppt,
    IUnknown FAR *pcmdTarget,
    IDispatch FAR *pdispObject
);

Parameters

dwID
Identifier of the context menu to be displayed.
ppt
POINT structure containing the screen coordinates for the menu.
pcmdTarget
Address of an IOleCommandTarget interface used to query command status and execute commands on this object.
pdispObject
Address of an IDispatch interface of the object at the screen coordinates specified in ppt. This allows a host to differentiate particular objects to provide more specific context.

Return Value

Returns one of the following values:

S_OK Host displayed its own UI. MSHTML will not attempt to display its UI.
S_FALSE Host did not display any UI. MSHTML will display its UI.
DOCHOST_E_UNKNOWN Menu identifier is unknown. MSHTML may attempt an alternative identifier from a previous version.

Remarks

In Microsoft® Internet Explorer 4.0 the pdispObject parameter supplied no information, but in Internet Explorer 5 and later the parameter contains the address of an IDispatch interface.

Windows CE

Windows CE Use version 2.12 and later
Minimum availability Internet Explorer 4.0

Example

The following code example shows how the pdispObject parameter is used.

IHTMLElement *pElem;
HRESULT hr;

hr = pdispObject->QueryInterface(IID_IHTMLElement, (void**)pElem);
if(SUCCEEDED (hr))
   {
   BSTR bstr;
   pElem->get_tagName(bstr);
   USES_CONVERSION;
   ATLTRACE("TagName:%s\n", OLE2T(bstr));
   SysFreeString(bstr);
   pElem->Release();
   }


Back to topBack to top

Did you find this topic useful? Suggestions for other topics? Write us!

© 1999 Microsoft Corporation. All rights reserved. Terms of use.