VB脚本怎么写啊?
的有关信息介绍如下:1、Private Sub Command1_Click()Const msg1 As String="请在这里输入你想显示的一段话!"Const msg2 As String="这里是对话框要显示的标题."MsgBox msg1,vbOkOnly,msg2 '此处代码一定不能添加()End Sub2、 form1按钮点击事件:form2.showform1.hide 3、启动VB程序,在窗体上放置6个命令按钮,三个标签,一个公用对话框、一个进度条、一个状态栏和一个计时器,窗本的布置请参考附图按钮"Open MP3 File"是用来打开对话框选择MP3文件,其他5个按钮分别为Play(播放)、Pause(暂停)、Stopplay(停止播放)、Back(向后跳跃)、Prew(向前跳跃)。Label1用来表示歌曲当前时间;label2放在时度条的最左边,Caption属性为"00:00";lable3放在时度条的右边,用来表示歌曲总长。下面就可以编写代码了。首先在窗体的"通用声明"部分声明函数Private Declare Function mciSendString Lib "winmm.dll" Alias "mciSendStringA" (ByVal lpstrCommand As String, ByVal lpstrRetumString As String, ByVal uReturnLength As Long, ByVal hwndCallback As Long) As LongDim mfn As String下面就是各个对象的代码了:Private Sub Form_load()mfn = ""play.Enabled = Falsepause.Enabled = Falsestopplay.Enabled = Falseback.Enabled = Falseprew.Enabled = FalseTimer1.Enabled = FalseTimer1.Interval = 500End SubPrivate Sub open_Click()On Error GoTo errWith CommonDialog1.CancelError = True.Filter = "音乐文件|*.mp3;*.wav;*.mid".Flags = cdlOFNNoChangeDir And cdlOFNPathMustExist.Action = 1stopplay_Click '停止按钮同时可以设备初始化mfn = .FileName '这个程序中文件名一定不能带空格Form1.Caption = .FileNameplay.Enabled = TrueEnd Withplay_ClickExit Suberr:End SubPrivate Sub play_Click()On Error Resume NextDim t As Longt = mciSendString("open " + mfn, 0&, 0, 0) 'Open后边的空格一定不能丢Dim ret As String * 128t = mciSendString("status " + mfn + " length", ret, 128, 0)'显示歌曲总长ret = Left(ret, 8)If ret <> "" ThenProgressBar1.min = 0ProgressBar1.Max = Val(ret)Label3.Caption = Gettime(Val(ret))End Ifplay.Enabled = Falsepause.Enabled = Truestopplay.Enabled = Trueback.Enabled = Trueprew.Enabled = Truet = mciSendString("status " + mfn + " mode", ret, 128, 0)'得到设备的当前状态,是播放还是暂停等等ret = Left(ret, 8)StatusBar1.Panels(1).Text = ret'在状态栏显示播放状态t = mciSendString("play " + mfn + " form " + Str(ProgressBar1.Value), 0&, 0, 0)'开始播放Timer1.Enabled = TrueEnd SubPrivate Sub pause_Click()t% = mciSendString("pause " + mfn, 0&, 0, 0)'发出暂停的命令play.Enable = Truepause.Enabled = Falsestopplay.Enabled = Trueback.Enabled = Falseprew.Enabled = FalseEnd SubPrivate Sub stopplay_Click()t% = mciSendString("stop " + mfn, 0&, 0, 0)t% = mciSendString("close " + mfn, 0&, 0, 0)'停止播放play.Enabled = Truepause.Enabled = Falsestopplay.Enabled = Falseback.Enabled = Falseprew.Enabled = FalseEnd SubPrivate Sub back_Click()t% = mciSendString("play " + mfn + " from " + Str(ProgressBar1.Value - (ProgressBar1.Max \ 10)), 0&, 0, 0) '向后跳一小段再播放End SubPrivate Sub prew_Click()t% = mciSendString("play " + mfn + " from " + Stri(ProgressBar1.Value + (ProgressBar1.Max \ 10)), 0&, 0, 0) '向前跳一小段再播放End SubPrivate Sub Timer1_Timer()Dim t As LongDim ret As String * 128t = mciSendString("status " + mfn + " position", ret, 0, 0)'得到当前播放位置ret = Left(ret, 8)ProgressBar1.Value = Val(ret)Label1.Caption = Gettime(Val(ret))'显示歌曲当前时间If ProgressBar1.Value = ProgressBar1.Max Thenstopplay_ClickEnd Ift = mciSendString("status " + mfn + " mode", ret, 128, 0)ret = Left(ret, 8)StatusBar1.Panels(1).Text = retEnd SubPrivate Sub Form_Unload(Cacel As Integer)t% = mciSendString("stop " + mfn, 0&, 0, 0)t% = mciSendString("close " + mfn, 0&, 0, 0)End SubPrivate Function Gettime(position As Long) As String'这个函数的功能是把以长整型表示的时间转换为电子钟式的"**:**"Dim min, secmin = position / 1000min = min / 60sec = min - Int(min)min = Int(min)sec = 60 * sec / 100sec = Int(sec * 100)Gettime = Str(min) + ":" + Str(sec)End Function