Solved

IContextmenu Icon-->

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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Process Javascript errors with Delphi TWebBrowser 1 130
Strange behavior when a form is closed 6 57
Convert MS Word document to a PDF file 9 78
Dynamically Created Query 3 55
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

786 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