dll problem,help me:)

R

rxgmoral

dll problem,help me:)
i create dll project ,the dll is Use MFC in a Static Library
i hope exe call ListCtrl class from dll

==================DLL====================
<<<<<<<<<<ListCtrl.h>>>>>>>>>>>>>>>
#pragma once
class AFX_EXT_CLASS ListCtrl :public CListCtrl
{
public:
__declspec(dllexport) ListCtrl();
__declspec(dllexport) ~ListCtrl();
public:
DECLARE_MESSAGE_MAP();
public:
afx_msg void OnNMClick(NMHDR *pNMHDR, LRESULT *pResult);
};

<<<<<<<<<<<ListCtrl.Cpp>>>>>>>>>>>
#include "Stdafx.h"
#include "ListCtrl.h"
ListCtrl::ListCtrl()
{}

ListCtrl::~ListCtrl()
{}

BEGIN_MESSAGE_MAP(ListCtrl,CListCtrl)
ON_NOTIFY_REFLECT(NM_CLICK, &ListCtrl::OnNMClick)
END_MESSAGE_MAP()

void ListCtrl::OnNMClick(NMHDR *pNMHDR, LRESULT *pResult)
{
AfxMessageBox(_T("OK"));
*pResult = 0;
}

=====================EXE============================
i Create Exe,the exe is Use MFC in a Static Library

<<<<<<<<<<<TestDlg.h>>>>>>>>>>>>
#pragma comment(lib,"Dll.lib")
#include "ListCtrl.h"
class TestDlg : public CDialog
{
DECLARE_DYNAMIC(TestDlg)
public:
TestDlg(CWnd* pParent = NULL); // standard constructor
virtual ~TestDlg();
enum { IDD = IDD_DIALOG1 };
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV
support
DECLARE_MESSAGE_MAP()
ListCtrl m_ListCtrl;
};

<<<<<<<<<<<<<<<TestDlg.Cpp>>>>>>>>>>
#include "stdafx.h"
#include "Test.h"
#include "TestDlg.h"

IMPLEMENT_DYNAMIC(TestDlg, CDialog)
TestDlg::TestDlg(CWnd* pParent /*=NULL*/)
: CDialog(TestDlg::IDD, pParent)
{}

TestDlg::~TestDlg()
{}

void TestDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
DDX_Control(pDX, IDC_LIST1, m_ListCtrl);
}

BEGIN_MESSAGE_MAP(TestDlg, CDialog)
ON_BN_CLICKED(IDOK, &TestDlg::OnBnClickedOk)
END_MESSAGE_MAP()

======================
the exe project call ListCtrl from dll project
Mouse click the m_ListCtrl window,error
why????
help me,thank you :)
 
B

Ben Voigt

rxgmoral said:
dll problem,help me:)
i create dll project ,the dll is Use MFC in a Static Library
i hope exe call ListCtrl class from dll

I think MFC extension dlls must use MFC in a Shared DLL
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top