Public Const WS_EX_DLGMODALFRAME = &H1&
Public Const WS_EX_TOPMOST = &H8&
Public Const GWL_EXSTYLE = (-20)
curstyle = GetWindowLong(NumberText.hwnd, GWL_EXSTYLE)
...
Public Const WS_EX_APP_WINDOW = &H40000
Public Const GWL_EXSTYLE = (-20)
Public Const GWL_STYLE = (-16)
Public Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
'
'
Private Sub Form_Load()
Dim curstyle As Long
curstyle = GetWindowLong(Me.hWnd, GWL_EXSTYLE)
If curstyle And WS_EX_APP_WINDOW Then
Debug."non modal"
Else
Debug.Print "modal"
End If
End Sub
'Form1
Option Explicit
Private Sub Command1_Click()
Form2.Show vbModal, Me
End Sub
Private Sub Command2_Click()
Form2.Show vbModeless, Me
End Sub
'Form2
Option Explicit
Private Sub Form_Click()
Dim curstyle As Long
curstyle = GetWindowLong(Me.hWnd, GWL_EXSTYLE)
If curstyle And WS_EX_APP_WINDOW Then
Print "non modal"
Else
Print "modal"
End If
End Sub
Если у Form2 выставлен ShowInTaskbar=False, то не работает даже в Form_Click
Сейчас этот форум просматривают: нет зарегистрированных пользователей и гости: 162