CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2003
    Location
    Portland, OR
    Posts
    894

    How to get IContextMenu from IShellLink?

    Hi everyone:


    My goal is to call IContextMenu::InvokeCommand on a default command of a context menu for a shortcut. I can get a reference to the IShellLink the following way:
    Code:
    IShellLink* pshl;   
    IPersistFile* ppf;   
      
    CoCreateInstance(CLSID_ShellLink, ..., &pshl);   
    pshl->QueryInterface(IID_IPersisFile, &ppf);   
    ppf->Load(pShortcutFilePath, STGM_READ);
    but how do I get a reference to IContextMenu then?

    Thank you!

  2. #2
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    6,633

    Re: How to get IContextMenu from IShellLink?

    From MSDN:
    IContextMenu Interface
    . . .
    Remarks
    . . .
    Applications use IContextMenu to retrieve information about the items in an object's shortcut menu and to invoke the associated commands. To retrieve an object's IContextMenu interface, an application must call the object's IShellFolder::GetUIObjectOf method.
    Best regards,
    Igor

  3. #3
    Join Date
    Jan 2008
    Posts
    48

    Re: How to get IContextMenu from IShellLink?

    It's a Win32 FAQ : you get it from the pidl
    see news://194.177.96.26/comp.os.ms-wind...ogrammer.win32
    (C/C++ code)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured