我这里有一个函数,大家看看有没有收藏价值:
Public Function Opclose(i As Integer)
Dim frm As Form, intI As Integer
Dim intForms As Integer
intForms = Forms.Count
If intForms > 0 Then
For intI = 0 To intForms - 1
Set frm = Forms(intI)
If i = 1 Then
frm.Visible = False
Else
frm.Visible = True
End If
Next intI
Else
Exit Function
End If
End Function
Public Function FormsShow(isShow As Boolean)
Dim frm As Form
Dim strErr As String
On Error GoTo Error_r
If isShow Then
For Each frm In Forms
frm.Visible = True
Next
Set frm = Screen.ActiveForm
frm.Modal = True
Else
For Each frm In Forms
frm.Modal = False
frm.Visible = False
Next
End If
用API的ShowWindow函数,要先声明:
Private Declare Function apiShowWindow Lib "user32" _
Alias "ShowWindow" (ByVal hWnd As Long, _
ByVal nCmdShow As Long) As Long
Private Sub Report_Open(Cancel As Integer)
apiShowWindow Forms("frmPay").hWnd, 0
apiShowWindow Forms("dlgPrint").hWnd, 0
End Sub
Private Sub Report_Close()
apiShowWindow Forms("frmPay").hWnd, 1
apiShowWindow Forms("dlgPrint").hWnd, 1
End Sub