我的工程中有一个类CFontBaseEditorPage,对话框类型,该类含有一个子类,在class CFontBaseEditorPage : public CPropertyPage
{
....
CImitateOsdToolBar *ImitateToolBar;//定义....
}
在CFontBaseEditorPage 初始化函数中生成一个实例,无模对话框.BOOL CFontBaseEditorPage::OnInitDialog()
{
....
ImitateToolBar = new CImitateOsdToolBar;
ImitateToolBar->Create(IDD_DIALOG_Imitate,NULL);
....
}下面是我希望用类ImitateToolBar 的成员函数调用父类的成员函数,运行windows 错误,请帮忙指点,感激
void CImitateOsdToolBar::OnImitateChooseColor()
{
CWnd* pWnd = GetParent();
while(!pWnd->IsKindOf(RUNTIME_CLASS(CFontBaseEditorPage)) && pWnd != NULL)
pWnd = pWnd->GetParent();//此处会失败 :( ((CFontBaseEditorPage*)pWnd)->RecordGlobalPalette();//RecordGlobalPalette();是CFontBaseEditorPage成员函数
}
{
....
CImitateOsdToolBar *ImitateToolBar;//定义....
}
在CFontBaseEditorPage 初始化函数中生成一个实例,无模对话框.BOOL CFontBaseEditorPage::OnInitDialog()
{
....
ImitateToolBar = new CImitateOsdToolBar;
ImitateToolBar->Create(IDD_DIALOG_Imitate,NULL);
....
}下面是我希望用类ImitateToolBar 的成员函数调用父类的成员函数,运行windows 错误,请帮忙指点,感激
void CImitateOsdToolBar::OnImitateChooseColor()
{
CWnd* pWnd = GetParent();
while(!pWnd->IsKindOf(RUNTIME_CLASS(CFontBaseEditorPage)) && pWnd != NULL)
pWnd = pWnd->GetParent();//此处会失败 :( ((CFontBaseEditorPage*)pWnd)->RecordGlobalPalette();//RecordGlobalPalette();是CFontBaseEditorPage成员函数
}
解决方案 »
- 为什么显示的是一幅完全黑色图片?
- 请问如何让VC像C#一样在异常退出时打印出函数调用栈?
- 一个菜鸟的网络编程入门疑惑:协议和接口是如何联系的?
- 用PostMessage发送消息,怎么用GetMessage获得呀?
- 急问!!vc中sql语句连接问题!
- 求高手指点(编译过程出现不能访问私有成员;strname,homeaddress,number),有构造函数也不行
- 如何把一个以desktop为父窗口的应用程序的窗口变成我的子窗口?
- VC,BROLAND C都没有graphics.h??
- 谁知道“登录奇兵”是用的什么安装软件!!!
- devenv怎么编译某个.sln下面的某个工程?
- 已经从BMP文件中读取了图像数据,如何分离出一行行数据?
- this关键字代表指针还是引用
BOOL CFontBaseEditorPage::OnInitDialog()
{
....
ImitateToolBar = new CImitateOsdToolBar;
ImitateToolBar-> Create(IDD_DIALOG_Imitate,NULL);
ImitateToolBar->SetParentHandle(this);
....
} void CImitateOsdToolBar::OnImitateChooseColor()
{
m_pParentHandle-> RecordGlobalPalette();//RecordGlobalPalette();是CFontBaseEditorPage成员函数
}
//
#define FIELD_OFFSET(type, field) ((LONG)(INT_PTR)&(((type *)0)->field))#define GET_NAME_OFFSET(table,rva) ((LONG)(table.Name - rva.VirtualAddress+rva.PointerToRawData))