hwnd of a B+ menu

BlitzPlus Forums/BlitzPlus Programming/hwnd of a B+ menu

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

hi Cold Harbour.

try this, it works for me.

if you need the decls, and constants , let me now.

function to add bitmaps to your menus

Function AddBitmapMenuIcon(window,subindex,menuindex,bitmapfile$,width=16,height=16)

	; get hwnd handle to passed window.
	hwnd = QueryObject(window,1)
	
	; check if it has a parent.
	real_hwnd = apiGetParent(hwnd)
	If real_hwnd <> 0 Then
		hwnd = real_hwnd
	EndIf
	
	; get the windows menu and submenu.
	hMenu_pointer = apiGetMenu(hwnd) 
	hMenu_subitem_pointer = apiGetSubMenu(hMenu_pointer,subindex)
	
	; open bitmap image to use in the menu.
	loadiconimage = apiLoadImage(0,bitmapfile$,IMAGE_BITMAP,width,height,LR_LOADFROMFILE)
	
	; add the icon to the windows menu item.
	icon = apiSetMenuItemBitmaps(hMenu_subitem_pointer,menuindex,MF_BYPOSITION,loadiconimage,loadiconimage)
	
End Function


kev