?
Solved

Popup menu added to context menu (shell extension)

Posted on 1998-10-15
1
Medium Priority
?
560 Views
Last Modified: 2013-12-03
I am writing a context menu shell extension.  How is it possible to have the item added to the context menu be a popup menu?  It would seem that calling InsertMenu using MF_POPUP does nothing and yet does not return 0.  I'm quite sure I've seen context menu shell extensions do this.
0
Comment
Question by:mrgentry
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 20

Accepted Solution

by:
Madshi earned 400 total points
ID: 1415296
mrgentry,

the following code is Delphi code. But I think you'll get how it works...

function TContextMenu.QueryContextMenu(Menu: HMENU; indexMenu,idCmdFirst,idCmdLast,uFlags: UINT) : HResult;
var c1       : cardinal;
    keyState : TKeyboardState;
    cc,ci    : cardinal;
begin
  result:=0;
  if (uFlags and CMF_VERBSONLY=0) and (uFlags and CMF_EXPLORE=0) and (uFlags and $F<>0) then
    exit;
  cc:=idCmdFirst; ci:=indexMenu;
  c1:=CreatePopupMenu;
  AppendMenu(c1, MF_STRING,    cc, 'Kontextmenü bearbeiten'); inc(cc);
  AppendMenu(c1, MF_SEPARATOR, 0,  nil                     );
  AppendMenu(c1, MF_STRING,    cc, 'Info'                  ); inc(cc);
  AppendMenu(c1, MF_STRING,    cc, 'Einstellungen'         ); inc(cc);
  InsertMenu(Menu, ci, MF_STRING or MF_POPUP or MF_BYPOSITION, c1, 'popup menu'); inc(ci);
  result:=ci-indexMenu;
end;

Regards, Madshi.
0

Featured Post

Introducing Priority Question

Increase expert visibility of your issues by participating in Priority Question, our latest feature for Premium and Team Account holders. Adjust the priority of your question to get emergent issues in front of subject-matter experts for help when you need it most.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows a few slightly more advanced techniques for Windows 7 gadget programming, including how to save and restore user settings for your gadget and how to populate the "details" panel that is displayed in the Windows 7 gadget gallery.  …
This article shows how to make a Windows 7 gadget that extends its U/I with a flyout panel -- a window that pops out next to the gadget.  The example gadget shows several additional techniques:  How to automatically resize a gadget or flyout panel t…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question