modunload.bas
来自「能分班系统采用Z线分班方法:即由系统自动抽签(也可由班主任抽签)」· BAS 代码 · 共 38 行
BAS
38 行
Attribute VB_Name = "ModUNLOAD"
Public Declare Function GetActiveWindow Lib "user32" () As Long
Public Function FormUnload(Optional bFormsModal As Boolean = True) As Boolean
Dim lForm As Long, fForm As Form, lLoopCount As Long, lActiveWindow As Long
On Error GoTo ErrFailed
If bFormsModal Then
'Unload all visible forms from topmost first.
'Note: cannot loop as uses the active window
lActiveWindow = GetActiveWindow
Do While lActiveWindow
For lForm = VB.Forms.Count - 1 To 0 Step -1
If VB.Forms(lForm).hwnd = lActiveWindow Then
'Found topmost form, unload it
'(Can add break point on line below)
Unload VB.Forms(lForm)
End If
Next
lActiveWindow = GetActiveWindow
If VB.Forms.Count = 0 Then
Exit Do
ElseIf lForm = -1 Then
'Failed to find active form
'(Make sure you are not debugging this loop)
Exit Do
End If
Loop
End If
'Unload forms (including hidden forms)
For Each fForm In VB.Forms
Unload fForm
Next
FormsSafeUnload = (VB.Forms.Count = 0)
Exit Function
ErrFailed:
FormsSafeUnload = False
End Function
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?