INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

API Functions

How to Place Icons on menu items in a form? by wgcs
Posted: 7 Nov 02

Thanks to Adolfo Huaman Capani for making this method clear.  You can get his complete example from the www.UniversalThread.com by searching for "
Icons in menu for any VFP version" or for the file menubitm.zip

The significant method is below:

*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/
*/*/*Desarrollado por Dofo
*/*/*        HCdofo@hotmail.com
*/*/*        HCdofo@yahoo.es
*/*/*        Huancayo - Peru
*/*/*        Adolfo Huaman Capani
*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/
LOCAL HWND, HMenu, HSubMenu, MenuBarID, lcImage, lbImage

****
* Get a handle on the Window and it's menu:
DECLARE INTEGER FindWindow    IN win32api STRING,STRING
DECLARE INTEGER GetMenu       IN win32api INTEGER
DECLARE INTEGER GetSubMenu    IN win32api INTEGER,INTEGER
DECLARE INTEGER GetMenuItemID IN win32api INTEGER,INTEGER

HWnd      = findwindow( 0, THISFORM.Caption )
HMenu     = getmenu( m.HWND )
HSubMenu  = getsubmenu( m.mhandle, 0 )  && First submenu
MenuBarID = getmenuitemid( m.HSubMenu, 0 ) && First menu item

****
* Load the Bitmap so we can use it
DECLARE INTEGER LoadImage IN win32api INTEGER, STRING, INTEGER, INTEGER, INTEGER, INTEGER

lcImage  = Set("DEFAULT")+CURDIR()+"Bitmap.Bmp"
lbImage  = Loadimage( 0, m.lcImage, 0, 13, 13, 32768+16+2 )

****
* Make adjustments to the menu
DECLARE INTEGER SetMenuItemBitmaps IN win32api INTEGER, INTEGER, INTEGER, INTEGER, INTEGER
DECLARE INTEGER ModifyMenu IN win32api INTEGER, INTEGER, INTEGER, INTEGER, STRING

setmenuitembitmaps( m.HSubMenu, m.MenuBarID, 0, m.lbImage, m.lbImage )

* Set the caption on the menu item, too:
modifymenu( m.HSubMenu, m.MenuBarID, 0, m.MenuBarID, "&Nuevo    F2" )


Back to Microsoft: Visual FoxPro FAQ Index
Back to Microsoft: Visual FoxPro Forum

My Archive

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close