【VC开源代码栏目提醒】:网学会员VC开源代码为您提供FlashPlayerView.cpp参考,解决您在FlashPlayerView.cpp学习中工作中的难题,参考学习。
// FlashPlayerView.cpp : implementation of the CFlashPlayerView class
//
#include "stdafx.h"
#include "FlashPlayer.h"
#include "FlashPlayerDoc.h"
#include "FlashPlayerView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CFlashPlayerView
IMPLEMENT_DYNCREATE(CFlashPlayerView, CHtmlView)
BEGIN_MESSAGE_MAP(CFlashPlayerView, CHtmlView)
//{{AFX_MSG_MAP(CFlashPlayerView)
ON_COMMAND(ID_FILE_OPEN, OnFileOpen)
ON_COMMAND(ID_MYREPLY, OnMyreply)
ON_COMMAND(ID_MYSTOP, OnMystop)
ON_UPDATE_COMMAND_UI(ID_MYREPLY, OnUpdateMyreply)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CFlashPlayerView construction/destruction
CFlashPlayerView::CFlashPlayerView()
{
// TODO: add construction code here
}
CFlashPlayerView::~CFlashPlayerView()
{
}
BOOL CFlashPlayerView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CHtmlView::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CFlashPlayerView drawing
void CFlashPlayerView::OnDraw(CDC* pDC)
{
CFlashPlayerDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
}
void CFlashPlayerView::OnInitialUpdate()
{
CHtmlView::OnInitialUpdate();
// TODO: This code navigates to a popular spot on the web.
// change the code to go where you'd like.
//改用空白页作为默认页
Navigate2(_T("about:blank"),NULL,NULL);
}
/////////////////////////////////////////////////////////////////////////////
// CFlashPlayerView diagnostics
#ifdef _DEBUG
void CFlashPlayerView::AssertValid() const
{
CHtmlView::AssertValid();
}
void CFlashPlayerView::Dump(CDumpContext& dc) const
{
CHtmlView::Dump(dc);
}
CFlashPlayerDoc* CFlashPlayerView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CFlashPlayerDoc)));
return (CFlashPlayerDoc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CFlashPlayerView message handlers
//处理播放消息的函数
void CFlashPlayerView::OnFileOpen()
{
// TODO: Add your command handler code here
//打开文件对话框,只允许打开.swf文件
CFileDialog dlg(TRUE, ".swf", NULL, OFN_HIDEREADONLY, "Flash (*.swf)|*.swf||", NULL);
if(dlg.DoModal() == IDOK)
{
//播放flash
m_strPath = dlg.GetPathName();
Navigate2(m_strPath, NULL, NULL);
}
}
//重放消息的处理函数
void CFlashPlayerView::OnMyreply()
{
// TODO: Add your command handler code here
Refresh();
}
//停止播放消息的处理函数
void CFlashPlayerView::OnMystop()
{
// TODO: Add your command handler code here
m_strPath = "";
OnInitialUpdate();
}
//当前没有在播放的flash,则重放按钮失效
void CFlashPlayerView::OnUpdateMyreply(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
if(m_strPath.IsEmpty())
pCmdUI->Enable(FALSE);
}
上一篇:
FlashPlayerDoc.cpp
下一篇:
村落共同体的核心架构研究