⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 flashplayerview.cpp

📁 本文件中包含的是《VC编程100例》一书中的源代码
💻 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);
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -