您的位置:首页 > 移动开发 > Objective-C

如何动态创建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());
 ////////////////////

 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: