• 十月jbd
    了解作者
  • C/C++
    开发工具
  • 87KB
    文件大小
  • rar
    文件格式
  • 0
    收藏次数
  • 1 积分
    下载积分
  • 0
    下载次数
  • 2020-05-08 14:26
    上传日期
vp的MFC框架,想要将MFC于vp结合的同学看一下
MFC-VP.rar
  • vp_mfc
  • res
  • MFC.ico
    1.1KB
  • Toolbar.bmp
    1.1KB
  • MFC.rc2
    395B
  • MFCDoc.ico
    1.1KB
  • Thumbs.db
    6.5KB
  • vp_mfcD.ilk
    325.2KB
  • vp_mfc.cpp
    4KB
  • vp_mfcDoc.cpp
    1.6KB
  • vp_mfc.h
    1.3KB
  • vp_mfcDoc.h
    1.4KB
  • vp_mfc.ncb
    49KB
  • vp_mfcView.cpp
    6.6KB
  • MainFrm.h
    1.5KB
  • vp_mfc.dsw
    537B
  • vp_mfcView.h
    1.7KB
  • readme.html
    6.3KB
  • Resource.h
    488B
  • StdAfx.cpp
    205B
  • vp_mfc.acf
    11.9KB
  • vp_mfc.rc
    10.1KB
  • vp_mfc.dsp
    4.8KB
  • MainFrm.cpp
    2.4KB
  • StdAfx.h
    1KB
  • vp_mfc.opt
    54.5KB
  • vp_mfc.plg
    2.7KB
内容介绍
// mfcView.cpp : implementation of the CMFCView class // #include "stdafx.h" #include "vp_mfc.h" #include "vp_mfcDoc.h" #include "vp_mfcView.h" // START: Vega Prime - Includes // NOTE: Vega Prime includes MUST be placed BEFORE // the line of code '#define new DEBUG_NEW' because // of a conflict created by redefining DEBUG_NEW. #include <vp.h> #include <vpKernel.h> #include <vpWindow.h> // END: Vega Prime - Includes #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CMFCView IMPLEMENT_DYNCREATE(CMFCView, CView) BEGIN_MESSAGE_MAP(CMFCView, CView) //{{AFX_MSG_MAP(CMFCView) ON_WM_CREATE() ON_WM_TIMER() ON_WM_SIZE() //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CMFCView construction/destruction CMFCView::CMFCView() { // TODO: add construction code here } CMFCView::~CMFCView() { // START: Vega Prime - Shutdown // Notify VP that we want to end frame loop vpKernel::instance()->breakFrameLoop(); // Allow VP to exit from frame loop int frameNum = vpKernel::instance()->beginFrame(); assert(frameNum == 0); int result; // vsgu::SUCCESS or vsgu::FAILURE result = vpKernel::instance()->unconfigure(); assert(result == vsgu::SUCCESS); result = vp::shutdown(); assert(result == vsgu::SUCCESS); // END: Vega Prime - Shutdown } BOOL CMFCView::PreCreateWindow(CREATESTRUCT& cs) { // TODO: Modify the Window class or styles here by modifying // the CREATESTRUCT cs return CView::PreCreateWindow(cs); } ///////////////////////////////////////////////////////////////////////////// // CMFCView drawing void CMFCView::OnDraw(CDC* pDC) { CMFCDoc* pDoc = GetDocument(); ASSERT_VALID(pDoc); // TODO: add draw code for native data here } ///////////////////////////////////////////////////////////////////////////// // CMFCView diagnostics #ifdef _DEBUG void CMFCView::AssertValid() const { CView::AssertValid(); } void CMFCView::Dump(CDumpContext& dc) const { CView::Dump(dc); } CMFCDoc* CMFCView::GetDocument() // non-debug version is inline { ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CMFCDoc))); return (CMFCDoc*)m_pDocument; } #endif //_DEBUG ///////////////////////////////////////////////////////////////////////////// // CMFCView message handlers int CMFCView::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CView::OnCreate(lpCreateStruct) == -1) return -1; // TODO: Add your specialized creation code here // START: Vega Prime - Initialization int result; // vsgu::SUCCESS or vsgu::FAILURE result = vp::initialize(__argc, __argv); assert(result == vsgu::SUCCESS); // set acf file CString acfFile; if (__argc <= 1) acfFile = "vp_mfc.acf"; else acfFile = __argv[1]; // load acf file result = vpKernel::instance()->define(acfFile); assert(result == vsgu::SUCCESS); // configure Vega Prime result = vpKernel::instance()->configure(); assert(result == vsgu::SUCCESS); // assuming at least one window in acf assert(vpWindow::size() != 0); // get the first Vega Prime window vpWindow *vpWin = *vpWindow::begin(); // set this MFC View window as the parent of the Vega Prime window vpWin->setParent(m_hWnd); // remove the Vega Prime border (use MFC parent window border instead) vpWin->setBorderEnable(false); // let MFC parent window determine our size by filling the MFC parent // window frame vpWin->setFullScreenEnable(true); // We can force the Vega Prime window open by calling beginFrame/endFrame // NOTE: OnActivateView requires the Vega Prime window open before it is // called. If it is not open, the Vega Prime window will never // get focus and thus will not handle keyboard input. int frameNum = vpKernel::instance()->beginFrame(); assert(frameNum != 0); result = vpKernel::instance()->endFrame(); assert(result == vsgu::SUCCESS); // setup timer that updates frame // NOTE: Timer messages (WM_TIMER) are low priority messages. They // are processed after all other messages have been processed. // Updating frames this way makes the application more responsive // at the expense of frame updates. // Timeout of -1 means send a WM_TIMER message as soon as the last // message was handled. This will allow the Vega Prime window to update // as fast as it can. const int TIMER_ID = 1; int returnValue = SetTimer(TIMER_ID, -1, NULL); assert(returnValue == TIMER_ID); // END: Vega Prime - Initialization return 0; } void CMFCView::OnTimer(UINT nIDEvent) { // TODO: Add your message handler code here and/or call default // START: Vega Prime - Frame Update int frameNum = vpKernel::instance()->beginFrame(); assert(frameNum != 0); int result = vpKernel::instance()->endFrame(); assert(result == vsgu::SUCCESS); // END: Vega Prime - Frame Update CView::OnTimer(nIDEvent); } void CMFCView::OnActivateView(BOOL bActivate, CView* pActivateView, CView* pDeactiveView) { // TODO: Add your specialized code here and/or call the base class CView::OnActivateView(bActivate, pActivateView, pDeactiveView); // START: Vega Prime - Set Focus // NOTE: Make sure base class OnActivateView is called BEFORE we set the // focus. Otherwise, the MFC Parent window will take the focus // from the Vega Prime window. The window with the focus receives // keyboard input. // if activating this view... if(bActivate) { // get the first Vega Prime window vpWindow *vpWin = *vpWindow::begin(); // set the focus HWND hVPWnd = vpWin->getWindow(); assert(::IsWindow( hVPWnd ) == TRUE); ::SetFocus(hVPWnd); } // END: Vega Prime - Set Focus } void CMFCView::OnSize(UINT nType, int cx, int cy) { CView::OnSize(nType, cx, cy); // TODO: Add your message handler code here // START: Vega Prime - Set Size // get the first Vega Prime window vpWindow *vpWin = *vpWindow::begin(); // set size of Vega Prime window vpWin->setSize(cx, cy); // END: Vega Prime - Set Size }
评论
    相关推荐