本文介绍了从dll创建CListCtrl的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

---------------------------DLL A----------------------------------
#ifdef SELIBCTRL_IMP
#define SELIBCTRL_API           __declspec(dllexport)
#define SELIBCTRL_EXT_CLASS    AFX_CLASS_EXPORT
#else
#define SELIBCTRL_API           __declspec(dllimport)
#define SELIBCTRL_EXT_CLASS    AFX_CLASS_IMPORT
#endif

class IListCtrl
{
   ...
};

SELIBCTRL_API IListCtrl* CreateIListCtrl(HWND hParent);

class CMyListCtrl : public CListCtrl, public IListCtrl
{
     ...
};
----------------------------DLL B------------------------------
void Test::CreateList()
{
    IListCtrl* pList = CreateIListCtrl(this->GetSafeHwnd());
}
---------------------------------------------------------------


我使用dll介面建立CMyListCtrl,并覆写DrawItem(),
但它无法接收ownerdraw消息,因此DrawItem()始终不运行,只能接收move事件.

PS:我尝试使用AFX_MANAGE_STATE(AfxGetStaticModuleState()),但它没有用

如果不使用A dll,请将CMyListCtrl类移至B dll,就可以了,
为什么会出现这个问题?谁能给我一个建议?谢谢.

-------------------------------------------------- -----------
致:Richard MacCutchan
创建此CListCtrl时已经设置了样式.
但是,非常感谢您的回答^^


I use a dll interface to create a CMyListCtrl, and override DrawItem(),
but it cant receive ownerdraw message,so DrawItem() is always not running, only can receive move event.

PS:I try use AFX_MANAGE_STATE(AfxGetStaticModuleState()), but its no useful

If dont use A dll, move the CMyListCtrl class to the B dll, it will be OK,
Why is this problem? Can anyone give me a suggestion? Thanks.

-------------------------------------------------------------
TO: Richard MacCutchan
I have already set the style when i create this CListCtrl.
But, thanks a lot of you answer^^

推荐答案


这篇关于从dll创建CListCtrl的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-23 09:54