为了更能说清楚我现在遇到的问题,我重新开贴,见谅啊。
我写了一个扩展mfc dll 中,定义了一个扩展类CRadarStateDialog,它派生于CXXDialog,CXXDialog派生于CMyDialog,CMyDialog派生于CDialog。 即:
CRadarStateDialog-----------CXXDialog----------CMyDialog---------CDialog。。然后我在主程序中调用这个dll, 调用代码为:#include"dll.h"
#pragma comment(lib,"Test.lib")class _declspec(dllimport) CRadarStateDialog;void CTestMyDllView::OnDianji()
{
pdlg=new CRadarStateDialog(this);pdlg->ShowWindow(SW_SHOW);
}
以下是我的 扩展dll的代码:dll.h文件#include"Resource.h"
class CMyDialog:public CDialog
{
public: CMyDialog(UINT ID,CWnd* pParnet):CDialog(ID,pParnet)
{
}
~CMyDialog(){}
// DECLARE_MESSAGE_MAP()};class CXXDialog:public CMyDialog
{
public:
CXXDialog(UINT ID,CWnd* pParent):CMyDialog(ID,pParent)
{
}
~CXXDialog(){}// DECLARE_MESSAGE_MAP()
};
//导出类
class _declspec(dllexport) CRadarStateDialog:public CXXDialog
{
public:
CRadarStateDialog(CWnd* pParent):CXXDialog(IDD,pParent)
{
m_pParent=pParent;
}
~CRadarStateDialog(){} enum{IDD=IDD_DIALOG1};private: CWnd* m_pParent;
//封装了一下
public:
void Produce()
{
Create(IDD,m_pParent);
}
// DECLARE_MESSAGE_MAP()
};////////////////////////////////////////////////////////////////////////////////////////////dll.cpp文件
#include"StdAfx.h"#include"dll.h"/*
BEGIN_MESSAGE_MAP(CMyDialog, CDialog)END_MESSAGE_MAP()BEGIN_MESSAGE_MAP(CXXDialog, CMyDialog)END_MESSAGE_MAP()
BEGIN_MESSAGE_MAP(CRadarStateDialog, CXXDialog)END_MESSAGE_MAP() */报错信息为:--------------------Configuration: TestMyDll - Win32 Debug--------------------
Linking...
Creating library Debug/TestMyDll.lib and object Debug/TestMyDll.exp
TestMyDllView.obj : error LNK2001: unresolved external symbol "protected: virtual struct AFX_MSGMAP const * __thiscall CRadarStateDialog::GetMessageMap(void)const " (?GetMessageMap@CRadarStateDialog@@MBEPBUAFX_MSGMAP@@XZ)
TestMyDllView.obj : error LNK2001: unresolved external symbol "protected: virtual struct AFX_MSGMAP const * __thiscall CXXDialog::GetMessageMap(void)const " (?GetMessageMap@CXXDialog@@MBEPBUAFX_MSGMAP@@XZ)
TestMyDllView.obj : error LNK2001: unresolved external symbol "protected: virtual struct AFX_MSGMAP const * __thiscall CMyDialog::GetMessageMap(void)const " (?GetMessageMap@CMyDialog@@MBEPBUAFX_MSGMAP@@XZ)
Debug/TestMyDll.exe : fatal error LNK1120: 3 unresolved externals
Error executing link.exe.TestMyDll.exe - 4 error(s), 0 warning(s)
当我取消 消息映射的注释后,依然报错,报错的信息与 ::GetMessageMap 有关系!!!!!!!!!!我查过msdn的说法,说是mfc类都有一个静态对象对应着, 当导出mfc类的时候,要特别小心高手解答一下,我到底该如何做??代码不复杂, 有编译器的兄台可以做个测试一下, 看是不是和我说的一样!!!!!1111代码直接复制就可以了
我写了一个扩展mfc dll 中,定义了一个扩展类CRadarStateDialog,它派生于CXXDialog,CXXDialog派生于CMyDialog,CMyDialog派生于CDialog。 即:
CRadarStateDialog-----------CXXDialog----------CMyDialog---------CDialog。。然后我在主程序中调用这个dll, 调用代码为:#include"dll.h"
#pragma comment(lib,"Test.lib")class _declspec(dllimport) CRadarStateDialog;void CTestMyDllView::OnDianji()
{
pdlg=new CRadarStateDialog(this);pdlg->ShowWindow(SW_SHOW);
}
以下是我的 扩展dll的代码:dll.h文件#include"Resource.h"
class CMyDialog:public CDialog
{
public: CMyDialog(UINT ID,CWnd* pParnet):CDialog(ID,pParnet)
{
}
~CMyDialog(){}
// DECLARE_MESSAGE_MAP()};class CXXDialog:public CMyDialog
{
public:
CXXDialog(UINT ID,CWnd* pParent):CMyDialog(ID,pParent)
{
}
~CXXDialog(){}// DECLARE_MESSAGE_MAP()
};
//导出类
class _declspec(dllexport) CRadarStateDialog:public CXXDialog
{
public:
CRadarStateDialog(CWnd* pParent):CXXDialog(IDD,pParent)
{
m_pParent=pParent;
}
~CRadarStateDialog(){} enum{IDD=IDD_DIALOG1};private: CWnd* m_pParent;
//封装了一下
public:
void Produce()
{
Create(IDD,m_pParent);
}
// DECLARE_MESSAGE_MAP()
};////////////////////////////////////////////////////////////////////////////////////////////dll.cpp文件
#include"StdAfx.h"#include"dll.h"/*
BEGIN_MESSAGE_MAP(CMyDialog, CDialog)END_MESSAGE_MAP()BEGIN_MESSAGE_MAP(CXXDialog, CMyDialog)END_MESSAGE_MAP()
BEGIN_MESSAGE_MAP(CRadarStateDialog, CXXDialog)END_MESSAGE_MAP() */报错信息为:--------------------Configuration: TestMyDll - Win32 Debug--------------------
Linking...
Creating library Debug/TestMyDll.lib and object Debug/TestMyDll.exp
TestMyDllView.obj : error LNK2001: unresolved external symbol "protected: virtual struct AFX_MSGMAP const * __thiscall CRadarStateDialog::GetMessageMap(void)const " (?GetMessageMap@CRadarStateDialog@@MBEPBUAFX_MSGMAP@@XZ)
TestMyDllView.obj : error LNK2001: unresolved external symbol "protected: virtual struct AFX_MSGMAP const * __thiscall CXXDialog::GetMessageMap(void)const " (?GetMessageMap@CXXDialog@@MBEPBUAFX_MSGMAP@@XZ)
TestMyDllView.obj : error LNK2001: unresolved external symbol "protected: virtual struct AFX_MSGMAP const * __thiscall CMyDialog::GetMessageMap(void)const " (?GetMessageMap@CMyDialog@@MBEPBUAFX_MSGMAP@@XZ)
Debug/TestMyDll.exe : fatal error LNK1120: 3 unresolved externals
Error executing link.exe.TestMyDll.exe - 4 error(s), 0 warning(s)
当我取消 消息映射的注释后,依然报错,报错的信息与 ::GetMessageMap 有关系!!!!!!!!!!我查过msdn的说法,说是mfc类都有一个静态对象对应着, 当导出mfc类的时候,要特别小心高手解答一下,我到底该如何做??代码不复杂, 有编译器的兄台可以做个测试一下, 看是不是和我说的一样!!!!!1111代码直接复制就可以了
解决方案 »
- 急,请教:如何将三个视频文件合并为一个文件(画中画效果)?VMR?Overlay?
- VC写的小QQ,有源代码
- 请教高手如何将普通JPG图片变成VC++对话框中能够直接Import使用的32*32的ICON图标,谢谢!
- 创建了一个C/C++专家群24409991,希望有经验的C/C++开发者和专家加入.
- 请教MDI绘图程序结构设计。
- 请问,控制台程序:怎么使输入密码为不可见?怎么才能使"Press any Key to continue"不显示?
- DialogBox怎么给自己发键盘左键消息?SendMessage(WM_KEYDOWN,WPARAM(VK_LEFT))不行
- 和女友分手,心情极度糟糕,散分!
- 如何学习COM?
- 用VC写的ActiveX控件,在Dephi中调用时的奇怪现象
- 将图片设为Windows桌面的API?
- 请教一个有关List Control控件的问题
直接重载 WindowProc,在里面自己处理
LRESULT CXXXXDlg::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{
// TODO: Add your specialized code here and/or call the base class
switch(message)
{
default: break;
……
}
return CBaseDlg::WindowProc(message, wParam, lParam);
}