1. 首頁
  2. 圖形影象/多媒體

VB4.0與Windows 95 API介面的多媒體應用程式設計的例項

VB4.0與Windows 95 API介面的多媒體應用程式設計的例項

Visual Basic以其簡單、快捷的特點深受廣大多媒體開發者的喜愛,VB4.0與Windows 95 API介面的多媒體應用程式設計例項。用Visual Basicfor Windows 95(以下簡稱VB4.0)可以迅速地編寫出真正的Windows 95應用軟體,尤其是在VB4.0中透過呼叫Windows 95 API函式,一方面可以靈活地利用Windows 95提供的'系統資源,另一方面無需呼叫VB的MCI(多媒體控制介面),使多媒體軟體編寫更方便。

本文所提供的源程式,具有簡單、方便操作和易於移植使用的特點。

該程式可以使使用者選擇播放*.AVI檔案,如稍加改動即可播放其他格式的多媒體檔案。本程式經VB4.0編譯透過。

呼叫*.AVI檔案源程式如下:

源程式清單:

’窗體files01.frm的特性表

VERSION 4.00

Begin VB.Form files01

Caption="Files"

ClientHeight=4365

ClientLeft=1095

ClientTop=1515

ClientWidth=7230

Height=4770

Left=1035

LinkTopic="files"

ScaleHeight=4365

ScaleWidth=7230

Top=1170

Width=7350

Begin VB.CommandButton Command1

Caption="Ok"

Height=735

Left=5880

TabIndex=4

Top=1800

Width=615

End

Begin VB.TextBox text1

Height=375

Left=600

TabIndex=3

Top=360

Width=5415

End

Begin VB.FileListBox File1

Height=2760

Left=2760

TabIndex=2

Top=1080

Width=2175

End

Begin VB.DirListBox Dir1

Height=2280

Left=600

TabIndex=1

Top=1560

Width=1815

End

Begin VB.DriveListBox Drive1

Height=315

Left=720

TabIndex=0

Top=1080

Width=1695

End

End

’窗體files01.frm程式碼

Attribute VB-Name="files01"

Attribute VB-Creatable=False

Attribute VB-Exposed=False

Private Sub Command1-Click

Load file02

flie02.Show

End Sub

Private Sub Dir1-Change

flie1.Path=Dir1.Path

End Sub

Private Sub Drive1-Change

Dir1.Path=Drive1.Drive

End Sub

Private Sub File1-Click

flie1.Path=Dir1.Path

End Sub

Private Sub File1-DblClick

pth$=Dir1.Path

If Right$(pth$,1)=""Then

Text1.Text=pth$ File1.FileName

Else

Text1.Text=pth$ "" File1.FileName

End If

End Sub

’窗體file02.frm特性表

VERSION 4.00

Begin VB.Form file02

Caption="file02"

ClientHeight=4230

ClientLeft=1095

ClientTop=1515