seba18
Programmer
- Jul 26, 2004
- 38
How can I put line separators (horivontal lines) between two menu commands in a VB6 menu?
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
'**************************************
'Windows API/Global 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
'**************************************
'Funtion/Sub Definitions
'**************************************
Public Sub SetBold(frmForm As Form, iMenuPos As Long, iItemPos As Long)
'frmForm [in]: parent form name of menu
'iMenuPos [in]: position of menu, starting from 0
'iItemPos [in]: position of submenu, starting from 0
Dim hMnu As Long, hSubMnu As Long
hMnu = GetMenu(frmForm.hwnd)
hSubMnu = GetSubMenu(hMnu, iMenuPos)
Call SetMenuDefaultItem(hSubMnu, iItemPos, 1&)
End Sub