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

📄 mainframe.h

📁 BCAM 1394 Driver
💻 H
字号:
//-----------------------------------------------------------------------------
//  (c) 2002 by Basler Vision Technologies
//  Section:  Vision Components
//  Project:  BCAM
//  $Header: MainFrame.h, 3, 08.10.2002 17:31:17, Nebelung, H.$
//-----------------------------------------------------------------------------
/**
  \file     MainFrame.h
  \brief    interface of the CMainFrame class
*/

#pragma once

#include "BitmapView.h"

class CMainFrame : public CFrameWindowImpl<CMainFrame>, public CUpdateUI<CMainFrame>,
  public CMessageFilter, public CIdleHandler
{
public:
  DECLARE_FRAME_WND_CLASS(NULL, IDR_MAINFRAME)
    
  CCommandBarCtrl m_CmdBar;
  CBitmapView m_view;
  
  virtual BOOL PreTranslateMessage(MSG* pMsg)
  {
    if(CFrameWindowImpl<CMainFrame>::PreTranslateMessage(pMsg))
      return TRUE;
    
    return m_view.PreTranslateMessage(pMsg);
  }
  
  virtual BOOL OnIdle()
  {
    return FALSE;
  }
  
  BEGIN_MSG_MAP(CMainFrame)
    MESSAGE_HANDLER(WM_CREATE, OnCreate)
    COMMAND_ID_HANDLER(ID_APP_EXIT, OnFileExit)
    COMMAND_ID_HANDLER(ID_CREATE_BITMAP, OnCreateBitmap)
    COMMAND_ID_HANDLER(ID_ACCESS_PIXELS, OnAccessPixels)
    COMMAND_ID_HANDLER(ID_LOAD_FROM_FILE, OnLoadFromFile)
    COMMAND_ID_HANDLER(ID_SAVE_TO_FILE, OnSaveToFile)
    COMMAND_ID_HANDLER(ID_ENUMERATE_ALL_CAMERAS, OnEnumerateAllCameras)
    COMMAND_ID_HANDLER(ID_GRAB_SINGLE_IMAGE, OnGrabSingleImage)
    COMMAND_ID_HANDLER(ID_SET_EXPOSURETIME, OnSetGain)
    COMMAND_ID_HANDLER(ID_GRAB_FORMAT7, OnGrabFormat7)
    COMMAND_ID_HANDLER(ID_GRAB_NONBLOCKING, OnGrabNonBlocking)
    COMMAND_ID_HANDLER(ID_GRAB_WITH_HARDWARE_TRIGGER, OnGrabWithHardwareTrigger)
    COMMAND_ID_HANDLER(ID_GET_INFO, OnGetInfo)
    COMMAND_ID_HANDLER(ID_GRAB_CONTINUOUSLY, OnGrabContinuously)
    CHAIN_MSG_MAP(CUpdateUI<CMainFrame>)
    CHAIN_MSG_MAP(CFrameWindowImpl<CMainFrame>)
  END_MSG_MAP()
    
  BEGIN_UPDATE_UI_MAP(CMainFrame)
  END_UPDATE_UI_MAP()
    
  LRESULT OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
  {
    
    // create command bar window
    HWND hWndCmdBar = m_CmdBar.Create(m_hWnd, rcDefault, NULL, ATL_SIMPLE_CMDBAR_PANE_STYLE);
    m_CmdBar.AttachMenu(GetMenu());
    
    // create view window
    m_hWndClient = m_view.Create(m_hWnd, rcDefault, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, WS_EX_CLIENTEDGE);
    //m_view.SetBitmap(NULL);
    
    // register object for message filtering and idle updates
    CMessageLoop* pLoop = _Module.GetMessageLoop();
    ATLASSERT(pLoop != NULL);
    pLoop->AddMessageFilter(this);
    pLoop->AddIdleHandler(this);
    
    return 0;
  }
  
  LRESULT OnFileExit(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
  {
    PostMessage(WM_CLOSE);
    return 0;
  }
  
  
  /**** The following methods are implemented in SampleCode.cpp **************/
  
  LRESULT OnCreateBitmap(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
  LRESULT OnAccessPixels(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
  LRESULT OnLoadFromFile(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
  LRESULT OnSaveToFile(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
  LRESULT OnEnumerateAllCameras(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
  LRESULT OnGrabSingleImage(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
  LRESULT OnSetGain(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
  LRESULT OnGrabFormat7(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
  LRESULT OnGrabNonBlocking(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
  LRESULT OnGrabWithHardwareTrigger(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
  LRESULT OnGetInfo(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
  LRESULT OnGrabContinuously(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
  
};

⌨️ 快捷键说明

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