桌面報(bào)時(shí)程序 這是一款簡(jiǎn)單的桌面報(bào)時(shí)程序,不需要播放控件的報(bào)時(shí)程序。。 Private Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As LONG) As LONG Const SND_SYNC = &H0 ''SND_SYNC播放WAV格式文件,播放完畢后將控制轉(zhuǎn)移回應(yīng)用中。 Const SND_ASYNC = &H1 ''SND_ASYNC播放WAV格式文件,將控制立即轉(zhuǎn)移回應(yīng)用程序中,而不管對(duì)WAV文件的播放是否結(jié)束。 Const address = "F:\My_Program\VB編程程序\報(bào)時(shí)鐘\Sounds\YY\"''報(bào)時(shí)音效文件 Dim hour_s As Integer, hour_g As Integer Dim minute_s As Integer, minute_g As Integer Public Function bs(addr As String) Dim tt As LONG tt = sndPlaySound(address + addr + ".wav", SND_SYNC) End Function Public Sub now_time() Dim h1 As Integer, m1 As Integer h1 = Hour(Time) m1 = Minute(Time) hour_s = h1 \ 10 ''小時(shí)和分?jǐn)?shù)據(jù)的讀取 hour_g = h1 Mod 10 minute_s = m1 \ 10 minute_g = m1 Mod 10 If hour_s = 1 Then ''小時(shí)的處理 bs (10) ElseIf hour_s = 2 Then bs (2) bs (10) End If If hour_g > 0 Then bs (hour_g) End If bs ("d") If (minute_s = 0) And (minute_g = 0) Then ''整點(diǎn)的判斷 bs ("z") Else If minute_s = 0 Then ''分的處理 bs (0) Else If minute_s > 1 Then bs (minute_s) End If bs (10) End If If minute_g <> 0 Then bs (minute_g) End If bs ("s") End If End Sub Private Sub Form_Load() Call now_time Unload Me End Sub
|