⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bformsmodal.bas

📁 1.如果在向导设置班级数为8时,此数值为班级总数
💻 BAS
字号:
Attribute VB_Name = "bFormsModal"
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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -