Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

IContextmenu Icon-->

Posted on 2000-03-09
2
Medium Priority
?
813 Views
Last Modified: 2010-04-04
When my app register a menuitem to Explorer-Shell Contextmenu ,
How can I add an Icon to this menuitem ?
------------->
I think that is easy to you ...:-)
0
Comment
Question by:Maria1977
2 Comments
 
LVL 17

Accepted Solution

by:
inthe earned 420 total points
ID: 2600692
hi,
you use setmenuitembitmaps() .for an example open delphi ContMenu example in demos\activeX\shellext folder.
drop a image into the folder (help.bmp).
in delphi add "graphics" to the uses section of contextM.pas and change the TContextMenu.QueryContextMenu function to look like this:

function TContextMenu.QueryContextMenu(Menu: HMENU; indexMenu, idCmdFirst,
          idCmdLast, uFlags: UINT): HResult;
     var
     bmp : tpicture;
          begin
  Result := 0; // or use MakeResult(SEVERITY_SUCCESS, FACILITY_NULL, 0);

  if ((uFlags and $0000000F) = CMF_NORMAL) or
     ((uFlags and CMF_EXPLORE) <> 0) then begin
    // Add one menu item to context menu
    InsertMenu(Menu, indexMenu, MF_STRING or MF_BYPOSITION, idCmdFirst,
      'Compile...');
  bmp:=tpicture.create;
  bmp.LoadFromFile('help.bmp');
  SetMenuItemBitmaps(Menu,indexMenu,MF_BYPOSITION,bmp.Bitmap.handle,bmp.bitmap.handle);
    // Return number of menu items added
    Result := 1; // or use MakeResult(SEVERITY_SUCCESS, FACILITY_NULL, 1)
  end;
end;


now compile build and register and right click a dpr file in explorer and see our icon on the menu :-)

Regards Barry
0
 

Author Comment

by:Maria1977
ID: 2609511
Many Thanks ! :-)
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …

782 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