用VC++制作播放AVI视频流的动画按钮(2)
三、实现代码
/////////////////////////////// AviButton.h : header file
#if !defined(AFX_AVIBUTTON_H__5E20D4EF_864E_11D7_886E_F16C81CD642B__INCLUDED_)
#define AFX_AVIBUTTON_H__5E20D4EF_864E_11D7_886E_F16C81CD642B__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
class CAviButton : public CButton
{
// Construction
public:
CAviButton();
public:
UINT m_nAviID;
CAnimateCtrl AnimateCtrl;
BOOL bPlaying;
void LoadAvi(UINT nAviID);
void DrawButton(CDC* pDC, UINT nState, CRect rect);
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CAviButton)
public:
virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
virtual BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD
dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID,
CCreateContext* pContext = NULL);
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CAviButton();
// Generated message map functions
protected:
//{{AFX_MSG(CAviButton)
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
#endif
////////////////////////////CAviButton.CPP文件;
#include "stdafx.h"
#include "TestAviButton.h"
#include "AviButton.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
CAviButton::CAviButton()
{
m_nAviID = 0;
bPlaying = FALSE;
}
CAviButton::~CAviButton()
{}
void CAviButton::LoadAvi(UINT nAviID)
{
m_nAviID =nAviID;
}