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

📄 mainfrm.cpp

📁 我近期从事视频开发所以将我参考的资料上传给大家看看。
💻 CPP
字号:
#include "stdafx.h"
#include "VidCap.h"
#include "MainFrm.h"
#include "VidCapDoc.h"
#include "VidCapView.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd)

BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
	//{{AFX_MSG_MAP(CMainFrame)
	ON_WM_CREATE()
	ON_WM_PALETTECHANGED()
	ON_WM_QUERYNEWPALETTE()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

static UINT indicators[] =
{
	ID_SEPARATOR,           // status line indicator
};

CMainFrame::CMainFrame()
{
}

CMainFrame::~CMainFrame()
{
}

int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
  //Let the parent class do its thing
	if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
		return -1;
	
  //Create the toolbar
	if (!m_wndToolBar.Create(this) ||
		!m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
	{
		TRACE0("Failed to create toolbar\n");
		return -1;      // fail to create
	}

  //Create the status bar
	if (!m_wndStatusBar.Create(this) ||
		!m_wndStatusBar.SetIndicators(indicators,
		  sizeof(indicators)/sizeof(UINT)))
	{
		TRACE0("Failed to create status bar\n");
		return -1;      // fail to create
	}

	m_wndToolBar.SetBarStyle(m_wndToolBar.GetBarStyle() |
		CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC);
  m_wndToolBar.SetWindowText(_T("Toolbar"));

	m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
	EnableDocking(CBRS_ALIGN_ANY);
	DockControlBar(&m_wndToolBar);

	return 0;
}

#ifdef _DEBUG
void CMainFrame::AssertValid() const
{
	CFrameWnd::AssertValid();
}

void CMainFrame::Dump(CDumpContext& dc) const
{
	CFrameWnd::Dump(dc);
}
#endif //_DEBUG

void CMainFrame::OnPaletteChanged(CWnd* /*pFocusWnd*/) 
{
  // Pass the buck to Capture window
  CVidCapView* pView = static_cast<CVidCapView*>(GetActiveFrame()->GetActiveView());
  if (pView)
  {
    ASSERT(pView->IsKindOf(RUNTIME_CLASS(CVidCapView)));
    const MSG* pMsg = GetCurrentMessage();
    pView->m_wndCap.PostMessage(pMsg->message, pMsg->wParam, pMsg->lParam); 
  }
}

BOOL CMainFrame::OnQueryNewPalette() 
{
  // Pass the buck to Capture window
  CVidCapView* pView = (CVidCapView*) GetActiveFrame()->GetActiveView();
  if (pView)
  {
    ASSERT(pView->IsKindOf(RUNTIME_CLASS(CVidCapView)));
    const MSG* pMsg = GetCurrentMessage();
    pView->m_wndCap.PostMessage(pMsg->message, pMsg->wParam, pMsg->lParam); 
  }
  return TRUE;
}

⌨️ 快捷键说明

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