Создаю в редакторе VB6 меню формы.
Делаю его Visible=false.
Но при таком свойстве меню не отображаеться на экране,если его вывести через TrackPopUpMenu.
Хотя методом формы PopUpMenu его показывает.
- Код: Выделить всё
Option Explicit
Private Declare Function GetMenu Lib "user32.dll" (ByVal hwnd As Long) As Long
Private Declare Function GetSubMenu Lib "user32.dll" (ByVal hMenu As Long, ByVal nPos As Long) As Long
Private Declare Function TrackPopupMenu Lib "user32.dll" (ByVal hMenu As Long, ByVal wFlags As Long, ByVal X As Long, ByVal Y As Long, ByVal nReserved As Long, ByVal hwnd As Long, ByRef lprc As RECT) As Long
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 2 Then
Dim lprc As RECT
Dim hm&, hsm&
hm = GetMenu(hwnd)
hsm = GetSubMenu(hm, 0)
TrackPopupMenu hsm, 0, 0, 0, 0, hwnd, lprc
'Me.PopupMenu pmenu - так показывает!
End If
End Sub
В чём может быть "несудьба"???