API函数mscisendstring的问题?

loveandhate 2002-09-14 10:52:34
用mcisendstring播放视频文件,怎样控制视频窗口。可以把视频窗口放在窗体里面吗?
...全文
62 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
huxiangming 2002-09-14
  • 打赏
  • 举报
回复
Video 视频(AVI)

Begin VB.Form AVI

Appearance = 0 'Flat

BackColor = &H00FFFFFF&

Caption = "AVI播放器 "

ClientHeight = 2700

ClientLeft = 3105

ClientTop = 3405

ClientWidth = 4710

ForeColor = &H80000008&

LinkTopic = "Form1"

PaletteMode = 1 'UseZOrder

ScaleHeight = 180

ScaleMode = 3 'Pixel

ScaleWidth = 314

WindowState = 2 'Maximized

End

Attribute VB_Name = "AVI"

Attribute VB_GlobalNameSpace = False

Attribute VB_Creatable = False

Attribute VB_PredeclaredId = True

Attribute VB_Exposed = False

Option Explicit

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

Private Sub Form_Click()

PlayVideo "f:\2.avi", AVI.hWnd

End

End Sub

Private Function Mcistring(commandstring As String) As String

Dim returnstring As String * 256

Dim dummy As Integer

dummy = mciSendString(commandstring, returnstring, 255, 0)

Mcistring = returnstring

End Function

Private Sub PlayVideo(FileName As String, ByVal hWindow As Integer)

Dim commandstring As String

Dim pstring As String * 255

'打开AVI设备

commandstring = "Open " & FileName & " alias AVI"

pstring = Mcistring(commandstring)

'设置输出窗口

commandstring = "Window AVI handle " & Str$(hWindow)

pstring = Mcistring(commandstring)

'定义全屏

commandstring = "Put AVI destination at 0 0 640 480"

'读者不妨试试改改字符串中0 0 648 480 几个字符,你会大吃一惊的!但要注意字符之 间要有空格。(显示模式为:640*480)

pstring = Mcistring(commandstring)

'播放AVI

MousePointer = 11

commandstring = "Play AVI wait "

pstring = Mcistring(commandstring)

MousePointer = 0

'关闭AVI设备

commandstring = "Close AVI"

pstring = Mcistring(commandstring)

End Sub

1,486

社区成员

发帖
与我相关
我的任务
社区描述
VB API
社区管理员
  • API
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧