BOOL CMoviePlayerApp::InitInstance()
{
AfxEnableControlContainer();
...
}
class CMoviePlayerDlg : public CDialog
{
...
// Dialog Data
//{{AFX_DATA(CMoviePlayerDlg)
enum { IDD = IDD_MOVIEPLAYER_DIALOG };
CActiveMovie3 m_ctrlMovie;
//}}AFX_DATA
...
// Generated message map functions
//{{AFX_MSG(CMoviePlayerDlg)
...
afx_msg void OnOpen();
afx_msg void OnOpenCompleteActivemoviecontrol1();
afx_msg void OnTimerActivemoviecontrol1();
DECLARE_EVENTSINK_MAP()
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
void CMoviePlayerDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CMoviePlayerDlg)
DDX_Control(pDX, IDC_ACTIVEMOVIECONTROL1, m_ctrlMovie);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CMoviePlayerDlg, CDialog)
//{{AFX_MSG_MAP(CMoviePlayerDlg)
...
ON_BN_CLICKED(IDC_OPEN, OnOpen)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
void CMoviePlayerDlg::OnOpen()
{
// TODO: Add your control notification handler code here
...
m_ctrlMovie.SetFileName(...);
...
}
BEGIN_EVENTSINK_MAP(CMoviePlayerDlg, CDialog)
//{{AFX_EVENTSINK_MAP(CMoviePlayerDlg)
ON_EVENT(CMoviePlayerDlg, IDC_ACTIVEMOVIECONTROL1, 50 /* OpenComplete */, OnOpenCompleteActivemoviecontrol1, VTS_NONE)
ON_EVENT(CMoviePlayerDlg, IDC_ACTIVEMOVIECONTROL1, 3 /* Timer */, OnTimerActivemoviecontrol1, VTS_NONE)
//}}AFX_EVENTSINK_MAP
END_EVENTSINK_MAP()
void CMoviePlayerDlg::OnOpenCompleteActivemoviecontrol1()
{
// TODO: Add your control notification handler code here
CRect rc;
GetClientRect(rc);
m_ctrlMovie.MoveWindow(10, 10, rc.Width()-20, rc.Height()-50);
}
void CMoviePlayerDlg::OnTimerActivemoviecontrol1()
{
// TODO: Add your control notification handler code here
double dPosition = m_ctrlMovie.GetCurrentPosition();
CString str;
str.Format("%5.2f sec", dPosition);
SetWindowText(str);
}