Sky Software Homepage LogicNP Software Knowledge Base And FAQ

 
Contact Product Support    SearchSearch      Subscribe to the RSS feed for this forum

HOWTO: Show a bitmap for a menu item

 
Subscribe to the RSS feed for this forum  Forum Index -> FileView ActiveX Control
View previous topic :: View next topic  
Author Message
Support



Joined: 18 Jul 2005
Posts: 731

Posted: Tue Jan 27, 2009 9:00 am    Post subject: HOWTO: Show a bitmap for a menu item

Use the following code in the OnContextMenuPopup event of the FileView Control to show a bitmap for a menu item :
[C++]
Code:
void CCustomContextMenuItemDlg::OnOnContextMenuPopupFileview(LPDISPATCH ShellMenu, BOOL BackgroundMenu, BOOL FAR* Cancel)
{
  CShellContextMenu shellContextMenu;
  shellContextMenu.AttachDispatch( ShellMenu,FALSE );

  CShellMenuItem newMenuItem = shellContextMenu.AddItem("Custom Menu Item");

  //Set the path of the bitmap file here
  CString imagePath = _T("C:\\logo.bmp");
  HBITMAP hBmp = (HBITMAP)LoadImage(AfxGetInstanceHandle(),imagePath,IMAGE_BITMAP,0,0, LR_LOADFROMFILE);
  CPictureHolder ph ;
  ph.CreateFromBitmap(hBmp,NULL,FALSE);
  newMenuItem.SetBitmap(ph.GetPictureDispatch());
}

[VB6]
Code:
Private Sub flView_OnContextMenuPopup(ByVal ShellMenu As FileViewControl.IShellContextMenu, ByVal BackgroundMenu As Boolean, Cancel As Boolean)
 
  Dim newMenuItem As ShellMenuItem
  Set newMenuItem = ShellMenu.AddItem("Custom Menu Item")

  Dim image As IPictureDisp
  Set image = LoadPicture("C:\logo.bmp")
  newMenuItem.SetBitmap image

End Sub
Back to top
Display posts from previous:   
Forum Index -> FileView ActiveX Control All times are GMT
Page 1 of 1

 
Jump to:  


Powered by phpBB © 2001, 2005 phpBB Group