我想在VB中插入一个视频,只要一运行到这个窗口时,就自动播放这个视频,该怎么做?

我想在VB中插入一个视频,只要一运行到这个窗口时,就自动播放这个视频,该怎么做?,第1张

Private Declare Function mciSendString Lib "winmmdll" Alias "mciSendStringA" (ByVal lpstrCommand As String, ByVal lpstrReturnString As String, ByVal uReturnLength As Long, ByVal hwndCallback As Long) As Long

Private Sub Command1_Click()

mciSendString "Close Myavi", vbNullString, 0&, 0&

mciSendString "OPEN " & AppPath & "\dawanavi ALIAS Myavi TYPE MPEGVideo", vbNullString, 0&, 0& 'AVIVideo解码器无声音,MPEGVideo缺有声音

mciSendString "Play Myavi fullscreen ", 0&, 0, 0&

End Sub

Private Sub Command2_Click()

Picture1Visible = False

mciSendString "Close Myavi", vbNullString, 0&, 0&

mciSendString "OPEN " & AppPath & "\dawanavi ALIAS Myavi TYPE MPEGVideo STYLE CHILD PARENT " & MehWnd, vbNullString, 0&, 0&

mciSendString "Play Myavi ", vbNullString, 0&, 0&

End Sub

Private Sub Command3_Click()

Picture1Visible = True

mciSendString "Close Myavi", vbNullString, 0&, 0&

mciSendString "OPEN " & AppPath & "\dawanavi ALIAS Myavi TYPE MPEGVideo STYLE CHILD PARENT " & Picture1hWnd, vbNullString, 0&, 0&

mciSendString "Play Myavi ", vbNullString, 0&, 0&

End Sub

《告白》百度网盘高清资源免费在线观看

w7br     

《告白》是一部2010年日本**,根据小说《告白》改编而成。中岛哲也执导,女演员松隆子主演。**讲述了某一天森口悠子发现其爱女被杀害在学校的游泳池中。尽管该起事件被断定为意外死亡,但森口却向学生们宣告犯人就在班中,并展开了自己的复仇。2011年,该片获得第30届香港**金像奖最佳亚洲**。

两种方法:

一、直接调用默认程序打开wmv文件进行播放

1、声明

Private Declare Function ShellExecute Lib "shell32dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long

2、播放函数

'36-1 打开网页地址

Sub Openwmv(formhwnd As Long, Url As String)

ShellExecute formhwnd, vbNullString, Url, vbNullString, vbNullString, 1

End Sub

二、动态创建控件进行播放,比较简单

Private Sub Command1_Click()

Dim AoshiMP, MP

Set AoshiMP = ControlsAdd("WMPlayerOCX7", "AoshiMP")

With AoshiMP

Top = 20

Left = 20

Height = 300

Width = 500

Visible = True

End With

Set MP = AoshiMPobject

With MP

uiMode = "none"

stretchToFit = True

Url = "http://wwwcccccom/upload/song/2009/2009-9/2d009-9-10/03151wmv"

Controlsplay

End With

End Sub

你用windows media player控件播放

一下是windows media player的基本属性

属性/方法 说明

URL:String; 指定媒体位置,本机或网络地址

uiMode:String; 播放器界面模式,可为Full, Mini, None, Invisible

playState:integer; 播放状态,1=停止,2=暂停,3=播放,6=正在缓冲,9=正在连接,10= 准备就绪

enableContextMenu:Boolean; 启用/禁用右键菜单

fullScreen:boolean; 是否全屏显示

[controls] wmpcontrols 播放器基本控制

controlsplay; 播放

controlspause; 暂停

controlsstop; 停止

controlscurrentPosition:double; 当前进度

controlscurrentPositionString:string; 当前进度,字符串格式。如“00:23”

controlsfastForward; 快进

controlsfastReverse; 快退

controlsnext; 下一曲

controlsprevious; 上一曲

[settings] wmpsettings 播放器基本设置

settingsvolume:integer; 音量,0-100

settingsautoStart:Boolean; 是否自动播放

settingsmute:Boolean; 是否静音

settingsplayCount:integer; 播放次数

[currentMedia] wmpcurrentMedia 当前媒体属性

currentMediaduration:double; 媒体总长度

currentMediadurationString:string; 媒体总长度,字符串格式。如“03:24”

currentMediagetItemInfo(const string); 取当前媒体信息"Title"=媒体标题,"Author"=艺术家,"Copyright"=版权信息,"Description"=媒体内容描述,"Duration"=持续时间(秒),"FileSize"=文件大小,"FileType"=文件类型,"sourceURL"=原始地址

currentMediasetItemInfo(const string); 通过属性名设置媒体信息

currentMedianame:string; 同 currentMediagetItemInfo("Title")

[currentPlaylist] wmpcurrentPlaylist //当前播放列表属性

currentPlaylistcount:integer; 当前播放列表所包含媒体数

currentPlaylistItem[integer]; 获取或设置指定项目媒体信息,其子属性同wmpcurrentMedia

欢迎分享,转载请注明来源:表白网

原文地址:https://h5.hunlipic.com/biaobai/4169698.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2024-04-20
下一篇2024-04-20

发表评论

登录后才能评论

评论列表(0条)

    保存