#if !defined(AFX_MYPANECTRL_H__7B1346F2_9D53_4A8A_8CEC_9B3CF4DECDF7__INCLUDED_)
#define AFX_MYPANECTRL_H__7B1346F2_9D53_4A8A_8CEC_9B3CF4DECDF7__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// MyPaneCtrl.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// CMyPaneCtrl form view
#ifndef __AFXEXT_H__
#include <afxext.h>
#endif
class CMyPaneCtrl : public CFormView
{
protected:
CMyPaneCtrl(); // protected constructor used by dynamic creation
DECLARE_DYNCREATE(CMyPaneCtrl)
// Form Data
public:
//{{AFX_DATA(CMyPaneCtrl)
enum { IDD = IDD_PANE_CMD };
// NOTE: the ClassWizard will add data members here
//}}AFX_DATA
// Attributes
public:
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CMyPaneCtrl)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
virtual ~CMyPaneCtrl();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
// Generated message map functions
//{{AFX_MSG(CMyPaneCtrl)
// NOTE - the ClassWizard will add and remove member functions here.
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_MYPANECTRL_H__7B1346F2_9D53_4A8A_8CEC_9B3CF4DECDF7__INCLUDED_)
// MyPaneCtrl.cpp : implementation file
//
#include "stdafx.h"
#include "bayes.h"
#include "MyPaneCtrl.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CMyPaneCtrl
IMPLEMENT_DYNCREATE(CMyPaneCtrl, CFormView)
CMyPaneCtrl::CMyPaneCtrl()
: CFormView(CMyPaneCtrl::IDD)
{
//{{AFX_DATA_INIT(CMyPaneCtrl)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
CMyPaneCtrl::~CMyPaneCtrl()
{
}
void CMyPaneCtrl::DoDataExchange(CDataExchange* pDX)
{
CFormView::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CMyPaneCtrl)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CMyPaneCtrl, CFormView)
//{{AFX_MSG_MAP(CMyPaneCtrl)
// NOTE - the ClassWizard will add and remove mapping macros here.
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMyPaneCtrl diagnostics
#ifdef _DEBUG
void CMyPaneCtrl::AssertValid() const
{
CFormView::AssertValid();
}
void CMyPaneCtrl::Dump(CDumpContext& dc) const
{
CFormView::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CMyPaneCtrl message handlers
CTabCtrlBar m_wndWorkspace;
// MainFrm.cpp : implementation of the CMainFrame class
//
#include "stdafx.h"
#include "Bayes.h"
#include "MainFrm.h"
#include "MyPaneCtrl.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CMainFrame
IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd)
BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
//{{AFX_MSG_MAP(CMainFrame)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code !
ON_WM_CREATE()
//}}AFX_MSG_MAP
ON_COMMAND_EX(CG_ID_VIEW_WORKSPACE, OnBarCheck)
ON_UPDATE_COMMAND_UI(CG_ID_VIEW_WORKSPACE, OnUpdateControlBarMenu)
END_MESSAGE_MAP()
static UINT indicators[] =
{
ID_SEPARATOR, // status line indicator
ID_INDICATOR_CAPS,
ID_INDICATOR_NUM,
ID_INDICATOR_SCRL,
};
/////////////////////////////////////////////////////////////////////////////
// CMainFrame construction/destruction
CMainFrame::CMainFrame()
{
// TODO: add member initialization code here
}
CMainFrame::~CMainFrame()
{
}
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
..........
InitWorkShop();
return 0;
}
int CMainFrame::InitWorkShop()
{
m_ImageList.Create(IDB_IMAGELIST, 13, 1, RGB(0,255,0));
// CG: The following block was inserted by the 'Dialog Bar' component
{
m_wndWorkspace.SetBtnImageList (&m_ImageList);
// m_wndWorkspace.SetMenuID(IDR_POPUP);
// Initialize dialog bar m_wndWorkspace
if (!m_wndWorkspace.Create(this, CG_ID_VIEW_WORKSPACE,
_T("工作区"), CSize(330,200)))
{
TRACE0("Failed to create dialog bar m_wndWorkspace\n");
return -1; // fail to create
}
// Add the views to the tab control.
m_wndWorkspace.AddView(_T("控制面板"), RUNTIME_CLASS(CMyPaneCtrl));
// m_wndWorkspace.AddView(_T("数据浏览"), RUNTIME_CLASS(CPaneDataBrowse));
// Define the image list to use with the tab control
m_TabImages.Create (IDB_IL_TAB, 16, 1, RGB(0,255,0));
m_wndWorkspace.SetTabImageList(&m_TabImages);
// allow bar to be resized when floating
m_wndWorkspace.SetBarStyle(m_wndWorkspace.GetBarStyle() |
CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC);
m_wndWorkspace.EnableDocking(CBRS_ALIGN_ANY);
EnableDocking(CBRS_ALIGN_ANY);
DockControlBar(&m_wndWorkspace, AFX_IDW_DOCKBAR_RIGHT);
}
return 0;
}
...............
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CMainFrame message handlers
Debug Assertion Failed!
Program:E:\VC\Bayes\Debug\Bayes.exe
File:viewform.cpp
Line:69
For information on how your program can cause an assertion
failuire,see the Visual C++ documentation on asserts.
(Press Retry to debug the application)
我主要是想RIUNTIME_CLASS()动态添加一个自定义的类,但是出现了上述错误,
有人说我没有实例画类对象(要添加这句话CObject* pObject = pRuntimeClass->CreateObject();//完成动态创建)
如果使得话添加到那里啊,如果不是高手给我指点一下