*********************************************************** ***** Practical environment: PB6.5 / PB70 / PB80 / PB90 function: Bitchart menu production method: as follows *********** ******************************** First step, first create a MENU object, named: m_bitmap. The design format has a main menu file. There are 4 submenu new / open / save / exit below, as follows: ---- File ----- -new -open -save -exit second step 2, find 4 bitmaps File, put it in the directory where Exe is located, named: new.bmp / open.bmp / save.bmp / exit.bmp third step, compiled code master form w_main, form type main, join the main menu m_menu. Examples of variable declarations: // Win32 constant CONSTANT Integer IMAGE_BITMAP = 0CONSTANT Integer LR_LOADFROMFILE = 16CONSTANT Integer SM_CXMENUCHECK = 71CONSTANT Integer SM_CYMENUCHECK = 72CONSTANT Integer MF_BITMAP = 4CONSTANT Integer MF_BYPOSITION = 1024 incorporated global external function API: FUNCTION ulong LoadImageA (ulong hintance, string filename, uint utype, & int x, int y, uint fload) LIBRARY "USER32.DLL" FUNCTION boolean SetMenuItemBitmaps (ulong hmenu, uint upos, uint flags, & ulong handle_bm1, ulong handle_bm2) LIBRARY "USER32.DLL" FUNCTION int GetSystemMetrics (int nIndex ) LIBRARY "USER32.DLL" FUNCTION ulong GetMenuItemID (ulong hMenu, uint uItem) LIBRARY "USER32.DLL" FUNCTION int GetSubMenu (ulong hMenu, int pos) LIBRARY "USER32.DLL" FUNCTION ulong GetMenu (ulong hWindow) LIBRARY "USER32. DLL "Function Boolean Modifymenu (Ulong Hmnu, Ulong Uposition, Ulong Uflags, & Ulong UidnewItem, Long LpNewi) Alias for ModifyMenua Library" User32.dll "
Open event: long ll_mainhandlelong ll_submenuhandleinteger li_menuitemidlong ll_xlong ll_ylong ll_bitmapnewlong ll_bitmapopenlong ll_bitmapsavelong ll_bitmapexit
// Get menu handle ll_mainhandle = getMenu (Handle (this))
// get the first menu item handle ll_SubMenuHandle = GetSubMenu (ll_MainHandle, 0) // load the image data ll_BitmapNew = LoadImageA (0, 'new.bmp', IMAGE_BITMAP, 0,0, LR_LOADFROMFILE) ll_BitmapOpen = LoadImageA (0, 'open.bmp', image_bitmap, 0, 0, lr_loadfromfile
/ / Take the first child item ID and modify menu li_menuitemid = getMenuitemid (ll_submenuhandle, 0) ModifyMenu (ll_submenuhandle, ll_menuitemid, mf_bitmap, li_menuitemid, ll_bitmapnew)
/ / A second submenu ID ID and modify menu Li_Menuitemid = getMenuitemid (ll_submenuhandle, 1) modifymenu (ll_submenuhandle, li_menuitemid, mf_bitmap, li_menuitemid, ll_bitmapopen)
// Get the default menu check-mark bitmap size ll_x = GetSystemMetrics (SM_CXMENUCHECK) ll_y = GetSystemMetrics (SM_CYMENUCHECK) // size of the loaded image system according ll_BitmapSave = LoadImageA (0, 'save.bmp', IMAGE_BITMAP, ll_x, ll_y , LR_LOADFROMFILE) ll_BitmapExit = LoadImageA (0, 'exit.bmp', IMAGE_BITMAP, ll_x, ll_y, LR_LOADFROMFILE) // set menu bitmap SetMenuItemBitmaps (ll_SubMenuHandle, 2, MF_BYPOSITION, ll_BitmapSave, ll_BitmapSave) SetMenuItemBitmaps (ll_SubMenuHandle, 3, MF_BYPOSITION, ll_BitmapExit , ll_bitmapexit)
Interested, don't try it.