📄 mdlpublic.vb
字号:
Module mdlPublic
#Region "API函数与变量声明"
'API声明。API是应用程序编程接口(Application Programming Interface)的缩写
'打开执行一个命令的API
Public Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Integer, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Integer) As Integer
Public Const SW_SHOW As Short = 5
'播放声音的API和与之有关的常数
Public Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Integer) As Integer
Public Const SND_ASYNC As Short = &H1S
Public Const SND_NODEFAULT As Short = &H2S
'获得计算机的开机时间(单位:毫秒)的API
Public Declare Function GetTickCount Lib "kernel32" () As Integer
#End Region
#Region "全局函数定义"
'用来播放声音的子过程
Public Sub PlaySound(ByRef strSound As String)
sndPlaySound(strSound, SND_ASYNC Or SND_NODEFAULT)
End Sub
'为程序进行延时的子过程
Public Sub TimeDelay(ByRef delayMilliseconds As Integer)
On Error Resume Next
Dim sngStartTime As Single '该变量用来记录开始时间
sngStartTime = GetTickCount() '开始时间为计算机的开机时间
Do Until (GetTickCount - sngStartTime) > delayMilliseconds
System.Windows.Forms.Application.DoEvents() '转让控制权
Loop
End Sub
#End Region
End Module
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -