Solved

menus

Posted on 2000-03-02
2
189 Views
Last Modified: 2010-05-02
how to give icon to user created menus?
0
Comment
Question by:avbreddy
2 Comments
 
LVL 3

Expert Comment

by:jetforce
ID: 2579385
Have a look at www.VBAccelerator.com there is a control which allows you to do this and also it gives you more options. You will also find more great controls there.

Hope this helps
0
 

Accepted Solution

by:
kartono earned 5 total points
ID: 2586196
To display the picture, use the setMenuItemBitmaps (API Functions), in the following steps :
1. Take the menu handle from the form
2. Get the submenu handle.
3. Set the bitmap for the specified item
   in the position. For this sample, use
   the picture control. According to
   the MSDN, it's better to use
   monochrome


Here is the sample code

'DECLARE THE GETMENU ITEM, THIS WILL GET THE MENU HANDLE FROM YOUR FORM

Private Declare Function GetMenu Lib "user32" (ByVal hwnd As Long) As Long

'THIS FUNCTION WILL RETRIEVE THE SUBMENU OF THE SPECIFIED MENU

Private Declare Function GetSubMenu Lib "user32" (ByVal hMenu As Long, ByVal nPos As Long) As Long

'API CONSTANT, WHICH SPECIFIES THE YOU WANT TO ACCESS THE SUBMENU BY POSITION

Private Const MF_BYPOSITION = &H400&

Private Sub GiveIcon
   dim mHDC as long
   dim msHDC as long
   dim pHDC as long

  'ME.HWND REFERS TO YOUR FORM HWND PROPERTY, RETURN ACTIVE MENU HANDLE
    mHDC = GetMenu(Me.hwnd)

  'GET SUBMENU FROM THE ACTIVE MENU
    msHDC = GetSubMenu(mHDC, 0)
  'GET THE HANDLE FROM PICTURE
    pHDC = myPic.Picture.Handle

  'SET THE MENU ITEM BITMAPS FOR THE
  'FIRST ITEM IN SUBMENU  
    lRet = SetMenuItemBitmaps(msHDC, 0, MF_BYPOSITION, pHDC, pHDC)

End Sub

Hope that helps

cheers

KN
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

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

920 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

15 Experts available now in Live!

Get 1:1 Help Now