如何动态创建ActiveMovieObject
2011-03-02 11:04
423 查看
//create an activeobject
/创建播放控件
CWnd *PlayerWnd;
PlayerWnd = CWnd::FromHandle(this-> m_hWnd);
m_pCActiveMovie3 =new CActiveMovie30;
ASSERT_VALID (m_pCActiveMovie3);
CRect rect;
PlayerWnd->GetWindowRect(rect);
PlayerWnd->ScreenToClient(rect);
m_pCActiveMovie3-> Create(_T ( "视频播放"), WS_OVERLAPPED|WS_VISIBLE,rect, PlayerWnd, IDC_ACTIVEMOVIECONTROL1);
// m_pCActiveMovie3->put_ShowControls(false);
m_pCActiveMovie3->put_FileName("C://Documents and Settings//new//My Documents//My Pictures//mov.avi");
m_pCActiveMovie3->Run();
/////////////////////////////////
CRect movieR,dlgR,clientR;
m_pCActiveMovie3->GetWindowRect(movieR);
//保证对话框客户区宽不小于300,高度>=55
if(movieR.Width()<300||movieR.Height()<255){
movieR.right = movieR.left+300;
movieR.bottom = movieR.top+255;
}
//得到窗口大小和客户区大小
this->GetWindowRect(dlgR);
this->GetClientRect(clientR);
//让对话框适应视频大小
this->MoveWindow(dlgR.left,dlgR.top,dlgR.Width()-clientR.Width()+movieR.Width(),dlgR.Height()-clientR.Height()+movieR.Height());
//居中到对话框
m_pCActiveMovie3->GetWindowRect(movieR);
this->GetClientRect(clientR);
m_pCActiveMovie3->MoveWindow((clientR.Width()-movieR.Width())/2,(clientR.Height()-movieR.Height())/2,movieR.Width(),movieR.Height());
////////////////////
/创建播放控件
CWnd *PlayerWnd;
PlayerWnd = CWnd::FromHandle(this-> m_hWnd);
m_pCActiveMovie3 =new CActiveMovie30;
ASSERT_VALID (m_pCActiveMovie3);
CRect rect;
PlayerWnd->GetWindowRect(rect);
PlayerWnd->ScreenToClient(rect);
m_pCActiveMovie3-> Create(_T ( "视频播放"), WS_OVERLAPPED|WS_VISIBLE,rect, PlayerWnd, IDC_ACTIVEMOVIECONTROL1);
// m_pCActiveMovie3->put_ShowControls(false);
m_pCActiveMovie3->put_FileName("C://Documents and Settings//new//My Documents//My Pictures//mov.avi");
m_pCActiveMovie3->Run();
/////////////////////////////////
CRect movieR,dlgR,clientR;
m_pCActiveMovie3->GetWindowRect(movieR);
//保证对话框客户区宽不小于300,高度>=55
if(movieR.Width()<300||movieR.Height()<255){
movieR.right = movieR.left+300;
movieR.bottom = movieR.top+255;
}
//得到窗口大小和客户区大小
this->GetWindowRect(dlgR);
this->GetClientRect(clientR);
//让对话框适应视频大小
this->MoveWindow(dlgR.left,dlgR.top,dlgR.Width()-clientR.Width()+movieR.Width(),dlgR.Height()-clientR.Height()+movieR.Height());
//居中到对话框
m_pCActiveMovie3->GetWindowRect(movieR);
this->GetClientRect(clientR);
m_pCActiveMovie3->MoveWindow((clientR.Width()-movieR.Width())/2,(clientR.Height()-movieR.Height())/2,movieR.Width(),movieR.Height());
////////////////////
相关文章推荐
- 如何使用CCRenderTexture创建动态纹理 cocos2d-x-3.0alpha0
- 如何在VC中创建动态数组
- VC6.0如何创建以及调用动态链接库具体实例
- Delphi中如何调用VC++创建的动态链接库
- Apache sdo学习笔记(四)——通过动态类型创建DataObject
- SQLSREVER如何创建和使用动态游标
- FLEX如何动态创建DataGrid组件详解
- C++如何创建、删除(释放内存)动态二维数组make2dArray
- 如何在FireFox中动态创建html元素(createElement)
- 如何获得一个动态创建的textview的ID?
- 如何在动态创建的表格中获取某一列的值(jquery)
- ABAP--如何创建动态结构的报表
- VC如何动态创建picture组件,按坐标创建在视图上,并且可以加入位图(从资源中加也可以)!
- Silverlight中如何自己写方法将DataTable转换为PagedCollectionView数据(动态创建类)
- DevExpress.XtraReports 如何动态运行时创建报表
- object-c如何创建一个简单的类
- XIB创建的cell中的已经适配过的控件如何动态改变高度?
- DevExpress.XtraReports 如何动态运行时创建报表
- 在.NET上如何根据字符串动态创建控件【转载】