Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / February 2007

Tip: Looking for answers? Try searching our database.

IDocHostUIHandler ShowContextMenu problem with one of the args

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
barker7@yahoo.com - 26 Feb 2007 20:01 GMT
I have created a context menu when a user right clicks on a link. I've
implemented IDocHostUIHandler and post the menu if the right click
happened on a link:

public uint ShowContextMenu(uint dwID, ref tagPOINT ppt, object
pcmdtReserved, object pdispReserved)
{
    Write(string.Format("Context menu on: {0}",
pdispReserved.GetType().ToString()));

    if (pdispReserved is HTMLAnchorElementClass)
    {
         // create the menu
         .....
         return 0;
    }
    return 1
}

On some PC's the first time the user right clicks a link, the above
method is calles, but the menu is NOT posted because the type of the
pDispReserved object appears to be "System.__ComObject" instead of
"HTMLAnchorElementClass".

Why is the pdispReserved object sometimes "System.__ComObject". Can
anyone explain what "System.__ComObject" is?

Thanks

Mitch
mh - 27 Feb 2007 01:39 GMT
On Feb 26, 12:01 pm, bark...@yahoo.com wrote:
> I have created a context menu when a user right clicks on a link. I've
> implemented IDocHostUIHandler and post the menu if the right click
[quoted text clipped - 27 lines]
>
> Mitch

dwID parameter contains the type of contextmenu. It is one of
       CONTEXT_MENU_DEFAULT = 0,
       CONTEXT_MENU_IMAGE = 1,
       CONTEXT_MENU_CONTROL = 2,
       CONTEXT_MENU_TABLE = 3,
       // in browse mode
       CONTEXT_MENU_TEXTSELECT = 4,
       CONTEXT_MENU_ANCHOR = 5,
       CONTEXT_MENU_UNKNOWN = 6,
       CONTEXT_MENU_IMGDYNSRC = 7,
       CONTEXT_MENU_IMGART = 8,
       CONTEXT_MENU_DEBUG = 9,
       CONTEXT_MENU_VSCROLL = 10,
       CONTEXT_MENU_HSCROLL = 11
Use a switch to find out if dwID is equal to CONTEXT_MENU_ANCHOR, show
your menu. If you need additional information in regard to the link,
simply cast pdispReserved to an IHTMLAnchorElement.
IHTMLAnchorElement phref = pdispReserved as IHTMLAnchorElement;
if(phref != null) //....

Hope this helps.

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.