标题:[求助]RIUNTIME_CLASS()????
只看楼主
m8311011725
Rank: 1
等 级:新手上路
帖 子:31
专家分:0
注 册:2006-3-11
 问题点数:0 回复次数:10 
[求助]RIUNTIME_CLASS()????

#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();//完成动态创建)
如果使得话添加到那里啊,如果不是高手给我指点一下

搜索更多相关主题的帖子: RIUNTIME CLASS 
2006-10-19 09:58
wfpb
Rank: 6Rank: 6
等 级:贵宾
威 望:29
帖 子:2188
专家分:0
注 册:2006-4-2
得分:0 
哪个类是你要自定义的?错误指向哪?

[glow=255,red,2]wfpb的部落格[/glow] 学习成为生活的重要组成部分!
2006-10-19 10:11
m8311011725
Rank: 1
等 级:新手上路
帖 子:31
专家分:0
注 册:2006-3-11
得分:0 

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)

2006-10-19 10:22
Bekky
Rank: 3Rank: 3
等 级:新手上路
威 望:7
帖 子:354
专家分:0
注 册:2006-5-29
得分:0 
没必要啊,RIUNTIME_CLASS本来就是个宏,直接用就可以了,何必搞复杂了??

我的编译环境为WinXp + VC 6.0 http://blog..cn/yobo
2006-10-19 11:34
m8311011725
Rank: 1
等 级:新手上路
帖 子:31
专家分:0
注 册:2006-3-11
得分:0 

用到RUTIME_CLASS宏的就在这一个地方

m_wndWorkspace.AddView(_T("控制面板"), RUNTIME_CLASS(CMyPaneCtrl));

提示的错误:

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)
我跟踪了一下,好像这个错误是说我创建的模板无效,不知道如何处理,知道原因的给我指点一下

2006-10-19 12:05
wfpb
Rank: 6Rank: 6
等 级:贵宾
威 望:29
帖 子:2188
专家分:0
注 册:2006-4-2
得分:0 
为什么我上MSDN上查询,AddView只有一个参数啊》?

[glow=255,red,2]wfpb的部落格[/glow] 学习成为生活的重要组成部分!
2006-10-19 12:35
m8311011725
Rank: 1
等 级:新手上路
帖 子:31
专家分:0
注 册:2006-3-11
得分:0 

我用的addview()函数是别人做的,不是msdn上的,主要是我想创建一个活动空间,例如vc显示类,资源和文件的那个工作空间,空间是做出来了,但是已用addview()添加视口就出错了。


是不是cformview派生的类不能这么做??

2006-10-19 15:01
m8311011725
Rank: 1
等 级:新手上路
帖 子:31
专家分:0
注 册:2006-3-11
得分:0 
????????????????????????????????????
2006-10-24 11:28
amoxic
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2006-11-28
得分:0 
我也遇到了类似的问题,望大虾们指点,不胜感激啊。
2006-11-29 09:14
amoxic
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2006-11-28
得分:0 
再问一下搂主,问题解决了吗
2006-11-29 09:15



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-97307-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.338906 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved