转至繁体中文版     | 网站首页 | 图文教程 | 资源下载 | 站长博客 | 图片素材 | 武汉seo | 武汉网站优化 | 
最新公告:     敏韬网|教学资源学习资料永久免费分享站!  [mintao  2008年9月2日]        
您现在的位置: 学习笔记 >> 图文教程 >> 软件开发 >> VB.NET程序 >> 正文
MCI播放器在VB中实现         ★★★★

MCI播放器在VB中实现

作者:闵涛 文章来源:闵涛的学习笔记 点击数:2092 更新时间:2009/4/23 16:38:06
==================
''''设置声道
''''======================================================
Public Function SetAudioSource(sAudioSource As AudioSource) As Boolean
    Dim RefInt As Long
    Dim strSource As String
    Select Case sAudioSource
        Case 1: strSource = "left"
        Case 2: strSource = "right"
        Case 0: strSource = "stereo"
    End Select
    SetAudioSource = False
    RefInt = mciSendString("setaudio  NOWMUSIC source to " & strSource, vbNull, 0, 0)
    If RefInt = 0 Then SetAudioSource = True
End Function

''''======================================================
''''全屏播放
''''======================================================
Public Function PlayFullScreen() As Boolean
    Dim RefInt As Long
    PlayFullScreen = False
    RefInt = mciSendString("play NOWMUSIC fullscreen", vbNull, 0, 0)
    If RefInt = 0 Then PlayFullScreen = True
End Function

''''=====================================================
''''设置声音大小
''''=====================================================
Public Function SetVolume(Volume As Long) As Boolean
    Dim RefInt As Long
    SetVolume = False
    RefInt = mciSendString("setaudio NOWMUSIC volume to " & Volume, vbNull, 0, 0)
    If RefInt = 0 Then SetVolume = True
End Function

''''=====================================================
''''设置播放速度
''''=====================================================
Public Function SetSpeed(Speed As Long) As Boolean
    Dim RefInt As Long
    SetSpeed = False
    RefInt = mciSendString("set NOWMUSIC speed " & Speed, vbNull, 0, 0)
    If RefInt = 0 Then SetSpeed = True
End Function

''''====================================================
''''静音True为静音,FALSE为取消静音
''''====================================================
Public Function SetAudioOnOff(AudioOff As Boolean) As Boolean
    Dim RefInt As Long
    Dim OnOff As String
    SetAudioOff = False
    If AudioOff Then OnOff = "off" Else OnOff = "on"
    RefInt = mciSendString("setaudio NOWMUSIC " & OnOff, vbNull, 0, 0)
    If RefInt = 0 Then SetAudioOff = True
End Function

''''====================================================
''''是否有画面True为有,FALSE为取消
''''====================================================
Public Function SetWindowShow(WindowOff As Boolean) As Boolean
    Dim RefInt As Long
    Dim OnOff As String
    SetWindowShow = False
    If WindowOff Then OnOff = "show" Else OnOff = "hide"
    RefInt = mciSendString("window NOWMUSIC  state " & OnOff, vbNull, 0, 0)
    If RefInt = 0 Then SetWindowShow = True
End Function

''''====================================================
''''获得当前媒体的状态是不是在播放
''''====================================================
Public Function IsPlaying() As Boolean
    Dim sl As String * 255
    mciSendString "status NOWMUSIC mode", sl, Len(sl), 0
    If Left(sl, 7) = "playing" Or Left(sl, 2) = "播放" Then
        IsPlaying = True
    Else
        IsPlaying = False
    End If
End Function

''''====================================================
''''获得播放窗口的handle
''''====================================================
Public Function GetWindowHandle() As Long
    Dim RefStr As String * 160
    mciSendString "status NOWMUSIC window handle", RefStr, 80, 0
    GetWindowHandle = Val(RefStr)
End Function

''''====================================================
''''获取DeviceID
''''====================================================
Public Function GetDeviceID() As Long
    GetDeviceID = mciGetDeviceID("NOWMUSIC")
End Function

上一页  [1] [2] 


[VB.NET程序]VB.NET中实现IEnumerator接口  [VB.NET程序]在VB中实现PickList功能
[Delphi程序]用API函数在DELPHI中实现“非典型”窗体  [Delphi程序]在Delphi中实现StringTokenizer功能模块
[网页制作]DW中实现flash的透明背景  [网页制作]Dreamweaver中实现flash的透明背景
[Web开发]ASP.NET 中实现 MD5_HMAC(C#)  [Web开发]在ASP 中实现ASP.Net 的DataGrid 功能(转载)
[Web开发]在ASP.NET中实现MVC模式(五)  [Web开发]在ASP.NET中实现MVC模式(四)
教程录入:mintao    责任编辑:mintao 
  • 上一篇教程:

  • 下一篇教程:
  • 【字体: 】【发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口
      注:本站部分文章源于互联网,版权归原作者所有!如有侵权,请原作者与本站联系,本站将立即删除! 本站文章除特别注明外均可转载,但需注明出处! [MinTao学以致用网]
      网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!)

    同类栏目
    · C语言系列  · VB.NET程序
    · JAVA开发  · Delphi程序
    · 脚本语言
    更多内容
    热门推荐 更多内容
  • 没有教程
  • 赞助链接
    更多内容
    闵涛博文 更多关于武汉SEO的内容
    500 - 内部服务器错误。

    500 - 内部服务器错误。

    您查找的资源存在问题,因而无法显示。

    | 设为首页 |加入收藏 | 联系站长 | 友情链接 | 版权申明 | 广告服务
    MinTao学以致用网

    Copyright @ 2007-2012 敏韬网(敏而好学,文韬武略--MinTao.Net)(学习笔记) Inc All Rights Reserved.
    闵涛 投放广告、内容合作请Q我! E_mail:admin@mintao.net(欢迎提供学习资源)

    站长:MinTao ICP备案号:鄂ICP备11006601号-18

    闵涛站盟:医药大全-武穴网A打造BCD……
    咸宁网络警察报警平台