Solved

Popup menu added to context menu (shell extension)

Posted on 1998-10-15
1
554 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
1 Comment
 
LVL 20

Accepted Solution

by:
Madshi earned 100 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
C#: need to import an entire CSV file 4 51
Which Microsoft MSDN Package Is The One I need? 3 41
WPF issue with Trigger 2 96
Visual Studio: built-in keystroke automation 2 49
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…
zlib is a free compression library (a DLL) on which the popular gzip utility is built.  In this article, we'll see how to use the zlib functions to compress and decompress data in memory; that is, without needing to use a temporary file.  We'll be c…
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…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

920 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now