Private Declare Function PlaySound Lib winmm.dll Alias PlaySoundA (ByVal lpszName As String, ByVal hModule As Long, ByVal dwFlags As Long) As Long Private Const SND_ASYNC = &H1 Private Const SND_FILENAME = &H20000
Private Sub Command1_Click() PlaySound e:\tmp\2.wav, 0&, SND_ASYNC + SND_FILENAME MsgBox 听到声音了吗? End Sub
Private Sub Command1_Click() WindowsMediaPlayer1.Visible = False On Error GoTo mp3 WindowsMediaPlayer1.URL = c:\欢迎使用.mp3 WindowsMediaPlayer1.Controls.Play mp3: End Sub
Private Sub Command1_Click() Dim a As Integer, x As Integer, f As Integer a = Val(Text1.Text) x = 2 Do If a Mod x = 0 Then f = 1 Exit Do Else f = 0 End If x = x + 1 Loop Until x = a If f = 1 Then Print 这是一个质数 Else Print 这是一个素数 '要加引号 End If End Sub