Solved

IContextmenu Icon-->

Posted on 2000-03-09
2
768 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
Comment Utility
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
Comment Utility
Many Thanks ! :-)
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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
This video discusses moving either the default database or any database to a new volume.
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

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

9 Experts available now in Live!

Get 1:1 Help Now