首页| 资讯| 移动| 云计算| 空间| 论坛| 博客| 下载| 网摘| 程序员| 书店| 培训充电 欢迎您:游客|退出|登录注册|帮助
CSDN-CSDN社区-其他数据库开发-VFP
管理菜单 生成帖子 置顶 推荐 取消推荐 锁定 解锁 移动 编辑 删除 帖子加分 帖子高亮 取消高亮 结 帖 发 帖 回 复 收藏 不显示删除回复显示所有回复显示星级回复显示得分回复 Windows Media Player控件,
ghd rare,都支持哪些设备类型,有没有这个控件相关的资料?想学习一下,希望各位老师帮助推荐一下。[问题点数:20分,结帖人:liuanzhao] liuanzhao (只约梦中人) 等 级: 结帖率:100.00% 楼主发表于:2008-09-09 17:13:58 Windows Media Player控件,都支持哪些设备类型,有没有这个控件相关的资料?想学习一下,希望各位老师帮助推荐一下 。 对我有用[0] 丢个板砖[0] 引用 举报 管理 TOP 回复次数:7394--> apple_8180 (十豆三) 等 级:
11
18
27
#1楼 得分:20回复于:2008-09-09 17:34:35
如需要阅读该回复,请登录或注册CSDN!
对我有用[0] 丢个板砖[0] 引用 举报 管理 TOP apple_8180 (十豆三) 等 级:
11
18
27
#2楼 得分:0回复于:2008-09-09 17:37:11 如果你安装的Windows Media Player 11,他能放哪些类型的视频,Windows Media Player控件就可以放 对我有用[0] 丢个板砖[0] 引用 举报 管理 TOP apple_8180 (十豆三) 等 级:
11
18
27
#3楼 得分:0回复于:2008-09-09 17:37:38 VBScript code
VFP调用Windows Media Player控件播放音乐、视频等(控件文件:wmp.dll ProgID:WMPlayer.OCX) *------------------------------------------------------------------------------ *--VFP调用Windows Media Player控件播放音乐、视频等 *--控件名称:Windows Media Player *--控件文件名:wmp.dll *--控件ProgID:WMPlayer.OCX *--运行环境:VFP8及以上 *MyPlayer("F:\test.mp3") *MyPlayer("D:\test.rmvb") Procedure MyPlayer(tcURL, tnDrive) Local loError, loCD If Vartype(tcURL)#"C" Or Empty(tcURL) * Sample URL tcURL = "http://radio.livephish.com:8000" Endif If Type("_SCREEN.oWMP")#"O" _Screen.AddObject("oWMP","WMPContainer") With _Screen.oWMP .Height = _Screen.Height .Width = _Screen.Width .Visible=.T. Endwith Endif If Upper(tcURL)=="CD" If tnDrive = -1 Return Endif loCD = _Screen.oWMP.oleWMP.cdromCollection.Item(tnDrive) _Screen.oWMP.oleWMP.currentPlaylist = loCD.Playlist Else _Screen.oWMP.oleWMP.url = tcURL Endif Endproc *---------- CLASSES ---------------------------------- Define Class WMPContainer As Container oWMPToolBar = Null Add Object oleWMP As OleControl With OleClass = 'WMPlayer.OCX' &&用到的文件为wmp.dll,名称Windows Media Player(C:\WINDOWS\system32\) Add Object tmrWMP1 As tmrWMP Procedure Init This.oleWMP.Width = This.Width+400 This.oleWMP.Height = This.Height+300 This.oWMPToolBar = Newobject('WMPToolBar', Sys(16), Null, This) This.oWMPToolBar.Visible = .T. Endproc Procedure Release _Screen.LockScreen = .T. This.RemoveObject('oleWMP') Release This _Screen.LockScreen = .F. Endproc Procedure oleWMP.DoubleClick(p1,p2,p3,p4) This.Visible = .F. This.Parent.Visible = .F. This.Parent.oWMPToolBar = Null This.Parent.tmrWMP1.Enabled = .T. Endproc Enddefine *-------------------------------------------- Define Class WMPToolBar As Toolbar ShowTips = .T. Caption = 'Fox Media Player' WMPContainer = Null Add Object CmdClose As CommandButton With ToolTipText = 'Close Fox Media Player', ; Picture = Home() + 'tools\test\close.bmp', SpecialEffect = 2, Height = 22, Width = 140 Procedure Init(WMPContainer As Object) This.WMPContainer = WMPContainer Endproc Procedure CmdClose.Click This.Parent.WMPContainer.oleWMP.DoubleClick() Endproc Enddefine *-------------------------------------------- Define Class tmrWMP As Timer Interval = 500 Enabled = .F. Procedure Timer This.Parent.Release() Endproc Enddefine 对我有用[0] 丢个板砖[0] 引用 举报 管理 TOP apple_8180 (十豆三) 等 级:
11
18
27
#4楼 得分:0回复于:2008-09-09 17:37:57 VBScript code
VFP中如何播放影片 *--------------------- 方法一:By dkfdtf Local cName, oForm m.cName = Sys(2015) _Screen.AddProperty( m.cName, Newobject( 'PlayerForm' )) m.oForm = Evaluate( '_Screen.' + m.cName ) m.oForm.Name = m.cName m.oForm.Show() Return Define Class PlayerForm As Form Width = 400 Height = 300 AutoCenter = .T. *!* AlwaysOnTop = .T. && 总在最前面 AllowOutput = .F. ShowWindow = 2 Caption = '简易媒体播放器' DoCreate = .T. Add Object player As OleControl With ; OleClass = 'WMPlayer.ocx.7' Procedure Init This.Resize() This.player.url = Getfile( 'avi;wmv;mpg;asf;rmvb' ) Endproc Procedure Destroy If Pemstatus( _Screen, This.Name, 5 ) Removeproperty( _Screen, This.Name ) Endif Endproc Procedure Resize This.player.Move( 0, 0, This.Width, This.Height ) Endproc Procedure player.Init With This .uiMode = 'full' && full / mini / none .StretchToFit = .T. && 自动缩放 .Settings.AutoStart = .F. && 自动开始播放 .Settings.Volume = 100 && 音量 Endwith Endproc Procedure player.StatusChange Thisform.Resize() Endproc Enddefine ----------------------------------------------------------------------- 方法二: 出处:http://blogs.msdn.com/calvin_hsia/archive/2006/09/28/775829.aspx PUBLIC ox as MyForm ox=CREATEOBJECT("MyForm") *Regsvr32 c:\WINDOWS\system32\msdxm.ocx DEFINE CLASS MyForm as Form height=600 width =800 oEv=0 && Event handler ref allowoutput=.f. fLoaded=.f. ADD OBJECT oc AS OleControl with; oleclass="AMOVIE.ActiveMovieControl.2" PROCEDURE init cFilename="d:\Test.avi" &&影片文件 this.oc.width=thisform.Width this.oc.height= thisform.Height this.oc.filename=cFilename this.oEv = CREATEOBJECT("evHandler",this) EVENTHANDLER(this.oc.object,this.oEv) IF thisform.Left < 0 or thisform.Left > SYSMETRIC(1)-100 && on 2nd monitor thisform.oc.object.MovieWindowSize= 1 ELSE thisform.oc.object.MovieWindowSize= 4 && amvOneHalfScreen ENDIF this.Show DO WHILE !thisform.fLoaded *!* DO WHILE this.oc.object.currentstate = -1 IF INKEY(.5)=27 EXIT ENDIF ENDDO thisform.oc.object.run ENDDEFINE DEFINE CLASS evHandler AS custom IMPLEMENTS DActiveMovieEvents2 IN "C:\WINDOWS\SYSTEM32\AMCOMPAT.TLB" oForm=null PROCEDURE init(oForm) this.oForm=oForm PROCEDURE DActiveMovieEvents2_StateChange(oldState AS Number, newState AS Number) AS VOID; HELPSTRING "Indicates that the current state of the movie has changed" * add user code here ENDPROC PROCEDURE DActiveMovieEvents2_PositionChange(oldPosition AS Number, newPosition AS Number) AS VOID; HELPSTRING "Indicates that the current position of the movie has changed" * add user code here ENDPROC PROCEDURE DActiveMovieEvents2_Timer() AS VOID; HELPSTRING "ActiveMovie Control's progress timer" * add user code here ENDPROC PROCEDURE DActiveMovieEvents2_OpenComplete() AS VOID; HELPSTRING "Reports that an asynchronous operation to open a file has completed successfully" ?PROGRAM() this.oform.fLoaded=.t. ENDPROC PROCEDURE DActiveMovieEvents2_Click() AS VOID * add user code here ENDPROC PROCEDURE DActiveMovieEvents2_DblClick() AS VOID * add user code here ENDPROC PROCEDURE DActiveMovieEvents2_KeyDown(KeyCode AS INTEGER, Shift AS INTEGER) AS VOID * add user code here ENDPROC PROCEDURE DActiveMovieEvents2_KeyUp(KeyCode AS INTEGER, Shift AS INTEGER) AS VOID * add user code here ENDPROC PROCEDURE DActiveMovieEvents2_KeyPress(KeyAscii AS INTEGER) AS VOID * add user code here ENDPROC PROCEDURE DActiveMovieEvents2_MouseDown(Button AS INTEGER, Shift AS INTEGER, x AS Number, y AS Number) AS VOID * add user code here ENDPROC PROCEDURE DActiveMovieEvents2_MouseMove(Button AS INTEGER, Shift AS INTEGER, x AS Number, y AS Number) AS VOID * add user code here ENDPROC PROCEDURE DActiveMovieEvents2_MouseUp(Button AS INTEGER, Shift AS INTEGER, x AS Number, y AS Number) AS VOID * add user code here ENDPROC PROCEDURE DActiveMovieEvents2_Error(SCode AS INTEGER, Description AS STRING, Source AS STRING, CancelDisplay AS LOGICAL) AS VOID * add user code here ENDPROC PROCEDURE DActiveMovieEvents2_DisplayModeChange() AS VOID; HELPSTRING "Indicates that the display mode of the movie has changed" * add user code here ENDPROC PROCEDURE DActiveMovieEvents2_ReadyStateChange(ReadyState AS VARIANT) AS VOID; HELPSTRING "Reports that the ReadyState property of the ActiveMovie Control has changed" * add user code here ENDPROC PROCEDURE DActiveMovieEvents2_ScriptCommand(bstrType AS STRING, bstrText AS STRING) AS VOID * add user code here ENDPROC ENDDEFINE 对我有用[0] 丢个板砖[0] 引用 举报 管理 TOP apple_8180 (十豆三) 等 级:
11
18
27
#5楼 得分:0回复于:2008-09-09 17:38:23 VBScript code
*!* ************************************************** ************** *!* 作者: dkfdtf - 2007.05.20 *!* 功能: 简单的调用 WMP 来播放视频剪辑 *!* ************************************************** ************** *!* PUBLIC oForm AS Form m.oForm = Newobject( 'AviForm' ) m.oForm.Show() Read Events Define Class AviForm As Form Width = 800 Height = 600 AutoCenter = .T. AlwaysOnTop = .T. AllowOutput = .F. ShowWindow = 2 DoCreate = .T. ShowTips = .T. state = 'none' Add Object player As OleControl With ; OleClass = 'WMPlayer.ocx.7', ; Mute = .F. Add Object slider As OleControl With ; OleClass = 'COMCTL.Slider.1' Add Object cmdOpen As CommandButton With ; Caption = Chr(0x31), ; FontName = 'Wingdings', ; FontSize = 12, ; TooltipText = '打开媒体文件' Add Object cmdReady As CommandButton With ; Caption = Chr(0x34), ; FontName = 'Webdings', ; FontSize = 14, ; TooltipText = '播放', ; Visible = .F. Add Object cmdPlay As CommandButton With ; Caption = Chr(0x34), ; FontName = 'Webdings', ; FontSize = 14, ; TooltipText = '播放', ; Enabled = .F. Add Object cmdPause As CommandButton With ; Caption = Chr(0x3b), ; FontName = 'Webdings', ; FontSize = 14, ; TooltipText = '暂停', ; Visible = .F. Add Object cmdStop As CommandButton With ; Caption = Chr(0x3c), ; FontName = 'Webdings', ; FontSize = 14, ; TooltipText = '停止', ; Enabled = .F. Add Object cmdMute As CommandButton With ; Caption = Chr(0x58), ; FontName = 'Webdings', ; TooltipText = '静音', ; FontSize = 16 Add Object lblMute As Label With ; Caption = Chr(0x78), ; FontName = 'Webdings', ; FontSize = 16, ; Alignment = 2, ; BackStyle = 0, ; ForeColor = 0x0000ff, ; TooltipText = '声音' Add Object lblStatus As Label With ; Caption = '', ; FontName = 'Arial', ; FontSize = 9, ; BackStyle = 0, ; ForeColor = 0xff0000 Add Object lblElapsed As Label With ; FontName = 'Arial', ; Alignment = 1, ; BackStyle = 0, ; Caption = '00:00' Add Object lbltotal As Label With ; FontName = 'Arial', ; Alignment = 0, ; BackStyle = 0, ; Caption = ' / 00:00' Add Object tmr1 As Timer With ; Enabled = .F., ; Interval = 1000 Procedure Init This.Caption = 'none' This.Resize() This.lblMute.Visible = This.player.Settings.Mute Endproc Procedure Unload Clear Events Endproc Procedure Caption_assign Lparameters tcString This.Caption = 'vfp.mplayer(coder: dkfdtf) - ' + m.tcString Endproc Procedure Resize Local iTop This.player.Move( 0, 0, This.Width,
GHD Deluxe Midnight Collection, This.Height - 60 ) m.iTop = This.Height - 40 + ( 40 - 26 ) / 2 This.cmdOpen.Move( 10, m.iTop, 30, 26 ) This.cmdPlay.Move( 40, m.iTop, 30, 26 ) This.cmdStop.Move( 70, m.iTop, 30, 26 ) This.cmdMute.Move( 100, m.iTop, 30, 26 ) This.lblMute.Move( 100, m.iTop, 30, 26 ) This.lblStatus.Move( 140, m.iTop+5, This.Width - 260, 18 ) This.lblElapsed.Move( This.Width - 110, m.iTop+5, 50, 18 ) This.lblTotal.Move( This.Width - 60, m.iTop+5, 60, 18 ) m.iTop = m.iTop - 25 This.slider.Move( 0, m.iTop, This.Width, 22 ) Endproc Procedure state_assign Lparameters tcState This.state = m.tcState Do Case Case ( 'play' == m.tcState ) This.cmdPlay.Enabled = .T. This.cmdPlay.Caption = This.cmdPause.Caption This.cmdPlay.FontName = This.cmdPause.FontName This.cmdPlay.ToolTipText = This.cmdPause.ToolTipText This.cmdStop.Enabled = .T. Case ( 'pause' == m.tcState ) This.cmdPlay.Enabled = .T. This.cmdPlay.Caption = This.cmdReady.Caption This.cmdPlay.FontName = This.cmdReady.FontName This.cmdPlay.ToolTipText = This.cmdReady.ToolTipText This.cmdStop.Enabled = .T. Case ( 'stop' == m.tcState ) This.cmdPlay.Enabled = .T. This.cmdPlay.Caption = This.cmdReady.Caption This.cmdPlay.FontName = This.cmdReady.FontName This.cmdStop.Enabled = .F. Otherwise This.cmdPlay.Enabled = .F. This.cmdStop.Enabled = .F. Endcase Endproc Procedure player.Init With This *!* 为了试验对 WMP 的控制, 不使用其本身的播放控制面板 *!* 如希望使用它自带的控制面板, 改为 full 或 mini .uiMode = 'full' && invisible, none, mini, full .StretchToFit = .T. && 自动伸展模式 *!* .FullScreen = .F. && 全屏幕播放 .Settings.AutoStart = .F. && 禁止自动播放 *!* .Settings.PlayCount = 10 && 播放次数( 值 0 设置总是不成功 ) *!* .Settings.balance = 0 && 左右声道平衡( -1.0 ~ 1.0 ) .Settings.Volume = 100 && 音量控制( 0 ~ 100 ) *!* .Settings.rate = 1 && 播放速率( 0 ~ 9, 部分媒体类型支持 ) .Visible = .T. Endwith Endproc Procedure player.mute_assign Lparameters tlMute This.mute = m.tlMute This.Settings.mute = m.tlMute Thisform.lblMute.Visible = m.tlMute Endproc Procedure player.Error Lparameters nError, cMethod, nLine If ( 1426 == m.nError ) Else Local cMsg TEXT TO m.cMsg NOSHOW TEXTMERGE 错误代码: <<MESSAGE()>> 出错位置: <<m.cMethod>> 出错行号: <<m.nLine>> ENDTEXT Messagebox( m.cMsg, 16,
ghd mini styler, '错误' ) Endif Endproc Procedure player.StatusChange With Thisform .Resize() If !Empty( This.Status ) If Empty( This.Controls.currentItem.durationString ) .lblTotal.Caption = ' / 00:00' .slider.LargeChange = 1 .slider.Max = 1 Else .lblTotal.Caption = ; ' / ' + This.Controls.currentItem.durationString .slider.Max = This.Controls.currentItem.duration .slider.LargeChange = Int( .slider.Max / 10 ) Endif If Empty( This.Controls.currentPositionString ) .lblElapsed.Caption = '00:00' .slider.Value = 0 Else .lblElapsed.Caption = This.Controls.currentPositionString Endif Endif Endwith Endproc Procedure slider.Change Thisform.player.Controls.currentPosition = This.Value Endproc Procedure slider.Scroll Thisform.player.Controls.currentPosition = This.Value Endproc Procedure cmdOpen.Click Local cFile m.cFile = Getfile( 'wmv;avi;mpeg;mpg;rm;rmvb' ) If !Empty( m.cFile ) With Thisform With .player .Close .url = m.cFile .Settings.mute = .mute Endwith .state = 'stop' .Caption = Lower( m.cFile ) .tmr1.Enabled = .T. Endwith Endif Endproc Procedure cmdPlay.Click With Thisform If ( 'play' == .state ) .player.Controls.Pause .state = 'pause' Else .player.Controls.Play .state = 'play' Endif Endwith Endproc Procedure cmdStop.Click With Thisform .player.Controls.stop .state = 'stop' Endwith Endproc Procedure cmdMute.Click Thisform.player.mute = .T. Endproc Procedure lblMute.Click Thisform.player.mute = .F. Endproc Procedure tmr1.Timer With Thisform If Empty( .player.Controls.currentPosition ) .lblElapsed.Caption = '00:00' Else .lblElapsed.Caption = ; .player.Controls.currentPositionString .slider.Value = .player.Controls.currentPosition Endif .lblStatus.Caption = .player.Status Endwith Endproc Enddefine 对我有用[0] 丢个板砖[0] 引用 举报 管理 TOP yrt888 (颜良) 等 级: #6楼 得分:0回复于:2008-09-09 22:33:19 很详细齐全,学习了! 对我有用[0] 丢个板砖[0] 引用 举报 管理 TOP apple_8180 (十豆三) 等 级:
11
18
27
#7楼 得分:0回复于:2008-09-10 08:50:16 转的大部分都是 dkfdtf 版主的。 对我有用[0] 丢个板砖[0] 引用 举报 管理 TOP 管理菜单 生成帖子 置顶 推荐 取消推荐 锁定 解锁 移动 编辑 删除 帖子加分 帖子高亮 取消高亮 结 帖 发 帖 回 复