ImageVerifierCode 换一换
格式:DOCX , 页数:14 ,大小:18.50KB ,
资源ID:7255528      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/7255528.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(vc制作视频播放器.docx)为本站会员(b****5)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

vc制作视频播放器.docx

1、vc制作视频播放器VC:制作视频播放器(ActiveX控件、工具栏、菜单栏、滑块、打开对话框)1、先把文件AMOVIE.OCX复制到某一目录下,例如D:下,然后选择“开始”|“运行”命令,输入“regsvr32D:AMOVIE.OCX”,单击“确定”按钮后,弹出对话框,显示注册成功。2、利用类向导,创建一个基于对话框的应用程序,删除向导自动生成的确定、取消按钮。选择Project?ADD。添加ActiveMovie Control Object选项。3、单击Insert按钮,关闭该对话框,ActiveMovie控件便出现在控件面板中,调整好控件在对话框中的位置。4、添加菜单资源。5、添加工具栏

2、。6、添加滑块控件,及变量。系统实现:1、设置对话框的最小化,对话框属性对话框中选择Style标签。2、添加工具栏。在OnInitDialog()函数中: if (!m_toolbar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_ALIGN_BOTTOM |CBRS_TOOLTIPS ) | !m_toolbar.LoadToolBar(IDR_TOOLBAR1) TRACE0(Failed to create toolbarn); return -1; / fail to create RepositionBars(AF

3、X_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST, 0); m_toolbar.SetBarStyle(m_toolbar.GetBarStyle()|CBRS_BOTTOM|CBRS_SIZE_DYNAMIC|CBRS_SIZE_DYNAMIC);3、利用类向导,添加“WM_SIZE”的消息映射:void CVideoDlg:OnSize(UINT nType, int cx, int cy) CDialog:OnSize(nType, cx, cy); / TODO: Add your message handler code here /工具

4、栏处在对话框的下端 RepositionBars(AFX_IDW_CONTROLBAR_FIRST,AFX_IDW_CONTROLBAR_LAST,0);/为了使滑块控件也可以一直显示在对话框的最下端位置 CRect rect; GetClientRect(rect);/得到客户端 int top=rect.top; rect.top=rect.bottom-60; rect.bottom=rect.top+30; if (IsWindow(m_sliderctrl.GetSafeHwnd() m_sliderctrl.MoveWindow(rect);/设置窗口大小 4、下面对菜单进行控制,

5、在对话框中的菜单资源是利用对话框属性在对话框中进行绑定的,这时的菜单资源仅仅是与对话框进行绑定。它不能响应ON_UPDATE_COMMAND_UI消息。为了响应这一事件,需要首先重载ON_WM_INITMENUPOPUP()消息。void CVideoDlg:OnInitMenuPopup(CMenu* pPopupMenu, UINT nIndex, BOOL bSysMenu) CDialog:OnInitMenuPopup(pPopupMenu, nIndex, bSysMenu); / TODO: Add your message handler code here ASSERT(pP

6、opupMenu != NULL); / Check the enabled state of various menu items. CCmdUI state; state.m_pMenu = pPopupMenu; ASSERT(state.m_pOther = NULL); ASSERT(state.m_pParentMenu = NULL); / Determine if menu is popup in top-level menu and set m_pOther to / it if so (m_pParentMenu = NULL indicates that it is se

7、condary popup). HMENU hParentMenu; if (AfxGetThreadState()-m_hTrackingMenu = pPopupMenu-m_hMenu) state.m_pParentMenu = pPopupMenu; / Parent = child for tracking popup. else if (hParentMenu = :GetMenu(m_hWnd) != NULL) CWnd* pParent = this; / Child windows dont have menus-need to go to the top! if (pP

8、arent != NULL &(hParentMenu = :GetMenu(pParent-m_hWnd) != NULL) int nIndexMax = :GetMenuItemCount(hParentMenu); for (int nIndex = 0; nIndex m_hMenu) / When popup is found, m_pParentMenu is containing menu. state.m_pParentMenu = CMenu:FromHandle(hParentMenu); break; state.m_nIndexMax = pPopupMenu-Get

9、MenuItemCount(); for (state.m_nIndex = 0; state.m_nIndex GetMenuItemID(state.m_nIndex); if (state.m_nID = 0) continue; / Menu separator or invalid cmd - ignore it. ASSERT(state.m_pOther = NULL); ASSERT(state.m_pMenu != NULL); if (state.m_nID = (UINT)-1) / Possibly a popup menu, route to first item o

10、f that popup. state.m_pSubMenu = pPopupMenu-GetSubMenu(state.m_nIndex); if (state.m_pSubMenu = NULL | (state.m_nID = state.m_pSubMenu-GetMenuItemID(0) = 0 | state.m_nID = (UINT)-1) continue; / First item of popup cant be routed to. state.DoUpdate(this, TRUE); / Popups are never auto disabled. else /

11、 Normal menu item. / Auto enable/disable if frame window has m_bAutoMenuEnable / set and command is _not_ a system command. state.m_pSubMenu = NULL; state.DoUpdate(this, FALSE); / Adjust for menu deletions and additions. UINT nCount = pPopupMenu-GetMenuItemCount(); if (nCount state.m_nIndexMax) stat

12、e.m_nIndex -= (state.m_nIndexMax - nCount); while (state.m_nIndex GetMenuItemID(state.m_nIndex) = state.m_nID) state.m_nIndex+; state.m_nIndexMax = nCount; void CVideoDlg:OnUpdateStop(CCmdUI* pCmdUI) / TODO: Add your command update UI handler code here pCmdUI-Enable(flag);6、为了使ActiveMovie控件进行播放,对Act

13、iveMovie控件进行属性设置。SelectionStart 0ShowDisplay 真ShowPositionContrls 真ShowSelectionControls 假ShowTracker 真Volume真等等。7、利用类向导为ActiveMovie控件添加变量CActiveMovie m_play;添加文件打开消息映射:void CVideoDlg:OnOpenFile() / TODO: Add your command handler code here CFileDialog FileDlg(TRUE,NULL,NULL,OFN_HIDEREADONLY|OFN_ALLO

14、WMULTISELECT|OFN_NOCHANGEDIR, Video File(*.avi;*.asf;*.wmv;*.rm;*.rmvb)|*.avi;*.asf;*.wmv;*.rm;*.rmvb|Music Files(*.mp3;*.wav;*.cda)|*.mp3;*.wav;*.cda|Mpegvideo File(*.dat;*.mpg;*.mpeg)|*.dat;*.mpg;*.mpeg;*.mpe|); if(FileDlg.DoModal()=IDOK) filename=FileDlg.GetPathName(); m_player.SetFileName(filena

15、me); flag=true; toolbarctrl-EnableButton(IDM_PLAY,true); toolbarctrl-EnableButton(IDM_PLAYPAUSE,true); toolbarctrl-EnableButton(IDM_STOP,true); toolbarctrl-EnableButton(IDM_ADD_VOLUME,true); toolbarctrl-EnableButton(IDM_SUB_VOLUME,true); MoveMovieWindow(); int iInstallresult; iInstallresult=SetTimer

16、(1,1000,NULL); if(iInstallresult=0) MessageBox(fail to install the timer!); 8、改变对话框的大小以适应ActiveMovie控件的大小:void CVideoDlg:MoveMovieWindow()/改变窗口大小以适应控件大小 CRect rc1,rc2,rc3; /得到ActiveMovie控件大小 m_player.GetWindowRect(rc1);/保证对话框客户区的宽不小于300象素,高不小于225象素 if(rc1.Width()300|rc1.Height()EnableButton(IDM_PLAY

17、PAUSE,false); toolbarctrl-EnableButton(IDM_STOP,false); toolbarctrl-EnableButton(IDM_ADD_VOLUME,false); toolbarctrl-EnableButton(IDM_SUB_VOLUME,false);11、音量大小调整:void CVideoDlg:OnAddVolume() / TODO: Add your command handler code here long m_Reduce = m_player.GetVolume(); if(m_Reduce=-1500) m_player.P

18、ause(); m_player.SetVolume(m_Reduce-100); m_player.Run(); 12、选择视频大小:void CVideoDlg:OnSizeFour() / TODO: Add your command handler code here m_player.Pause(); m_player.SetFullScreenMode(false); m_player.SetMovieWindowSize(3); m_player.Run(); num=3;void CVideoDlg:OnUpdateSizeFour(CCmdUI* pCmdUI) / TODO

19、: Add your command update UI handler code here pCmdUI-Enable(flag); if(num=3) pCmdUI-SetCheck(true); else pCmdUI-SetCheck(false);void CVideoDlg:OnSizeSixten() / TODO: Add your command handler code here m_player.Pause(); m_player.SetFullScreenMode(false); m_player.SetMovieWindowSize(2); m_player.Run(

20、); num=2;void CVideoDlg:OnUpdateSizeSixten(CCmdUI* pCmdUI) / TODO: Add your command update UI handler code here pCmdUI-Enable(flag); if(num=2) pCmdUI-SetCheck(true); else pCmdUI-SetCheck(false);void CVideoDlg:OnSizeTwo() / TODO: Add your command handler code here m_player.Pause(); m_player.SetFullScreenMode(false); m_player.SetMovieWindowSize(4); m_player.Run(); num=4;void CVideoDlg:OnUpdateSizeTwo(CCmdUI* pCmdUI) / TODO: Add your command update UI handler code here pCmdUI-Enable(flag); if(num=4)

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1