Solved

IContextmenu Icon-->

Posted on 2000-03-09
2
772 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 105 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

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

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…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…

912 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

18 Experts available now in Live!

Get 1:1 Help Now