Solved

Popup menu added to context menu (shell extension)

Posted on 1998-10-15
1
553 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
Comment Utility
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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

This article describes how to programmatically preset the "Pages per Sheet" option that's available with most printer drivers.   This setting lets you do "n-Up" printing, where two, four, or more pages are printed on each sheet of paper. If your …
In this article, I will show how to use the Ribbon IDs Tool Window to assign the built-in Office icons to a ribbon button.  This tool will help us to find the OfficeImageId that corresponds to our desired built-in Office icon. The tool is part of…
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…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

744 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

16 Experts available now in Live!

Get 1:1 Help Now