📄 start.bas
字号:
Attribute VB_Name = "Start"
Public SqlConnect As Boolean
Public Con As ADODB.Connection
Public Declare Function GetDesktopWindow Lib "user32" () As Long
Public Declare Function GetAsyncKeyState Lib "user32" (ByVal vkey As Long) As Integer
Public Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
'过程(函数)
Sub Main()
If App.PrevInstance = True Then
MsgBox "已有当前程序在运行!", 16, "严重错误"
Exit Sub
End If
'应用初始化
AppInitialize
'登录
Login
'显示主窗口
FrmMain.Show
End Sub
'初始化
Private Sub AppInitialize()
App.Title = "教务管理系统 V1.0.0【网络版】 " & "chlf78"
End Sub
'登录
Sub Login()
'显示splash窗口
Splash.Show
Set Con = New ADODB.Connection
'显示登录窗口
frmSQLLogin.Show vbModal, Splash
If SqlConnect = False Then 'if user cancel login then the app end
ReleaseResource
End
Else 'login successfully, then record user info
'销毁登录窗口
Unload frmSQLLogin
Set frmSQLLogin = Nothing
'销毁splash窗口
Unload Splash
Set Splash = Nothing
End If
End Sub
'释放资源(除了发起窗体)
Sub ReleaseResource(Optional Sender As Object)
'卸载所有窗体
Dim i As Long
On Error Resume Next
For i = Forms.Count - 1 To 0 Step -1
Unload Forms(i)
If Not Force Then
If Forms.Count > i Then
Exit Sub
End If
End If
Next i
If Force Or (Forms.Count = 0) Then Close
If Force Or (Forms.Count > 0) Then End
Con.Close
End Sub
Public Function MyHotKey(vKeyCode) As Boolean
MyHotKey = (GetAsyncKeyState(vKeyCode) < 0)
End Function
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -