CodePudding user response:
'Form1, add 3 buttons,
Option Explicit
Private Declare Function IsWindowVisible Lib "user32. DLL" (ByVal HWND) As Long As Long
The Function CheckForm (ByVal FormName As String) As Long
Dim FRM As Form
For Each FRM Forms In
If FRM. Name=FormName Then
The Exit For
End the If
Next
If FRM Is Nothing Then
CheckForm=1 'was not loaded
ElseIf IsWindowVisible (FRM) HWND)=0 Then
CheckForm=0 'invisible
The Else
Visible CheckForm=1 '
End the If
End the Function
Private Sub Command1_Click ()
MsgBox CheckForm (" Form2 ")
End Sub
Private Sub Command2_Click ()
The Load Form2
Form2. Hide '& lt; - if it is a child form, will automatically be, according to the Load force hidden, general form is hidden, '
MsgBox CheckForm (" Form2 ")
Unload Form2
End Sub
Private Sub Command3_Click ()
Form2. Show
MsgBox CheckForm (" Form2 ")
Unload Form2
End Sub
CodePudding user response:
He got the FORM object after windowsstate attributes,CodePudding user response:
WindowsState is minimizing state, and whether the loading, showing what relation?CodePudding user response:
Get a Boolean variable, the form_load set to true, an unload set false...