How to make a menu item (toolbar) bold?

Janus
01-31-2005, 08:00 AM
Hi folks!

It's no problem for me to make a standard menu item bold by using SetMenuDefaultItem-API. Now I'd like to use the same procedure with a toolbar control where I've got a ButtonMenu. Unfortunately, I don't get it to work.

Any hint would be appreciated.


Private Declare Function GetMenu Lib "user32" (ByVal hWnd As Long) As Long
Private Declare Function GetSubMenu Lib "user32" (ByVal hMenu As Long, ByVal nPos As Long) As Long
Private Declare Function SetMenuDefaultItem Lib "user32" (ByVal hMenu As Long, ByVal uItem As Long, ByVal fByPos As Long) As Long

Public Sub MakeMIBold(hWnd As Long, lMenuIndex As Long, lItemIndex As Long)
Dim lMnu As Long, lSubMnu As Long

lMnu = GetMenu(hWnd)
lSubMnu = GetSubMenu(lMnu, lMenuIndex)
Call SetMenuDefaultItem(lSubMnu, lItemIndex, 1&)
End Sub


Addition:
I just can't get the handle of the ButtonMenu. :(

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum