?? module1.bas
字號:
Attribute VB_Name = "Module1"
Option Explicit
'播放聲音的API和與之有關的常數
Public Declare Function sndPlaySound Lib "winmm.dll" _
Alias "sndPlaySoundA" (ByVal lpszSoundName As String, _
ByVal uFlags As Long) As Long
Public Const SND_ASYNC = &H1
Public Const SND_NODEFAULT = &H2
Public PortItem As Integer '端口
Public DataBit As Integer '數據位
Public BaudRate As Integer '波特率
Public StopBit As Integer '停止位
Public ParityCheck As Integer '奇偶校驗
Public Function GetMyFormatDate() As String '得到****-**-**格式的日期
Dim MyMonth As String
Dim MyDay As String
MyMonth = Month(Date)
MyDay = Day(Date)
If Len(MyMonth) = 1 Then
MyMonth = "0" & MyMonth
End If
If Len(MyDay) = 1 Then
MyDay = "0" & MyDay
End If
GetMyFormatDate = Year(Date) & "-" & MyMonth & "-" & MyDay
End Function
Public Function GetMyFormatTime() As String '得到**:**格式的時間
Dim H As String
Dim M As String
H = Hour(Time)
M = Minute(Time)
If Len(H) = 1 Then
H = "0" & H
End If
If Len(M) = 1 Then
M = "0" & M
End If
GetMyFormatTime = H & ":" & M
End Function
Public Function GetMyFormatDataAndTime() As String
Dim DataAndTime As String
DataAndTime = GetMyFormatDate & " " & GetMyFormatTime
GetMyFormatDataAndTime = DataAndTime
End Function
Public Sub DoMySleep(a As Double) '延時函數,a 為秒
Dim t As Date
t = DateAdd("s", a, Now)
Do While Now < t
DoEvents
Loop
End Sub
'用來播放聲音的子過程
Public Sub PlaySound(strSound As String)
sndPlaySound strSound, SND_ASYNC Or SND_NODEFAULT
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -