Я против VB - похоже что счет 2:0 Не пашет конструкция!alibek писал(а):Forms().SetFocus
[Через n+1 минут]
Урра, этот вариант заработал!!! Respect всем!
Я против VB - похоже что счет 2:0 Не пашет конструкция!alibek писал(а):Forms().SetFocus
Dim frm() As Form1
...
ReDim frm(0)
...
ReDim Preserve frm(0 To UBound(frm)+1)
Set frm(UBound(frm)) = New Form1
Load frm(UBound(frm))
...
frm(Index).SetFocus
Private Sub TaskButtons_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
Dim hMenu As Long, T As RECT
If Button = 2 Then
mMenu = GetSystemMenu(Forms(TaskButtons.SelectedItem.Index).hwnd, 0)
TrackPopupMenu hMenu, 0, x, y, 0, Forms(TaskButtons.SelectedItem.Index).hwnd, T
End If
End Sub
ZlydenGL писал(а):Меню не вызывается. Что не так?
Option Explicit
Private Declare Function GetSystemMenu Lib "user32" (ByVal hWnd As Long, ByVal bRevert As Long) As Long
Private Declare Function TrackPopupMenu Lib "user32" (ByVal hMenu As Long, ByVal wFlags As Long, ByVal x As Long, ByVal y As Long, ByVal nReserved As Long, ByVal hWnd As Long, lprc As Any) As Long
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Type POINTAPI
x As Long
y As Long
End Type
Private Sub Form_Click()
Dim pt As POINTAPI
GetCursorPos pt
TrackPopupMenu GetSystemMenu(hWnd, 0), 0, pt.x, pt.y, 0, hWnd, ByVal 0&
End Sub
Option Explicit
Private Declare Function GetSystemMenu Lib "user32" (ByVal hWnd As Long, ByVal bRevert As Long) As Long
Private Declare Function TrackPopupMenu Lib "user32" (ByVal hMenu As Long, ByVal wFlags As Long, ByVal x As Long, ByVal y As Long, ByVal nReserved As Long, ByVal hWnd As Long, lprc As Any) As Long
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Private Type POINTAPI
x As Long
y As Long
End Type
Private Sub Form_Click()
Dim pt As POINTAPI
GetCursorPos pt
SendMessage hWnd, &H112, TrackPopupMenu(GetSystemMenu(hWnd, 0), &H100, pt.x, pt.y, 0, hWnd, ByVal 0&), 65536 * pt.x + pt.y
End Sub
Сейчас этот форум просматривают: AhrefsBot, SemrushBot и гости: 4