Search Tools Links Login

Bold Menu Item With Win32 API's

Makes a menu item bold (for defualt items) by using Windows API's.

Original Author: Smoke


Call the function in the following manner:
Call SetBold(Me, 1, 2)
Me = The form
1 = Menu index for mnuEdit
2 = Item index for mnuEditPaste

API Declarations

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 SetBold(frmBold As Form, iMenuIndex As Long, iItemIndex As Long)
Dim hMnu As Long, hSubMnu As Long
hMnu = GetMenu(frmBold.hwnd)
hSubMnu = GetSubMenu(hMnu, iMenuIndex)
Call SetMenuDefaultItem(hSubMnu, iItemIndex, 1&)
End Sub

About this post

Posted: 2002-06-01
By: ArchiveBot
Viewed: 123 times


Visual Basic 6


No attachments for this post

Loading Comments ...


No comments have been added for this post.

You must be logged in to make a comment.