nbsp; public:
BEGIN_MSG_MAP(CVideoPlayerQT)
MY_QT_MSG_HANDLE (NewProc)
END_MSG_MAP()
protected:
LRESULT NewProc(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
……
CQuickTime m_QT;
……
}
CQuickTime为笔者调用QuickTime API的辅助类,后面将介绍。
NewProc成员函数根据接收不同的窗口消息分别调用不同的成员函数处理。
LRESULT CQTVideoWnd::NewProc(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
if(uMsg == WM_ERASEBKGND)
{
bHandled = FALSE;
LRESULT theResult = DefWindowProc(uMsg, wParam, lParam);
m_QT.ProcessMovieEvent (m_hWnd, uMsg, wParam, lParam);
return theResult;
}
else
{
m_QT.ProcessMovieEvent (m_hWnd, uMsg, wParam, lParam);
switch(uMsg)
{
case WM_CREATE:
OnCreate(uMsg, wParam, lParam,bHandled);
break;
case WM_PAINT:
OnPaint(uMsg, wParam, lParam,bHandled);
break;
case WM_DESTROY:
OnDestroy(uMsg, wParam, lParam,bHandled);
break;
default:
bHandled = FALSE;
break;
}
}
return 0;
}
其中OnCreate、OnPaint、OnDestroy等成员函数将根据2.2,分别调用辅助类CQuickTime处理。如
LRESULT CQTVideoWnd::OnCreate(UINT uMsg, WPARAM wParam , LPARAM lParam, BOOL& bHandled)
{
m_QT.OnMovieWindowCreate(m_hWnd,NULL);
return 0;
}
3.2 CQuickTime
CQuickTime为调用QuickTime API函数的辅助类。
3.2.1初始化和退