本文介绍了CListCtrl RedrawItem函数中的问题.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在为Windows CE5.0移动设备开发应用程序.每隔15毫秒,我将在CListCtrl中执行重绘操作.当CListCtrl重绘时,设备的可用物理内存减少了4kb.我不知道减少物理内存的原因.如果有人知道答案,请告诉我.提前谢谢.
以下是我的代码段.
I am developing application for Windows CE5.0 mobile device. Every 15 milliseconds, i am performing the redraw operation in CListCtrl. when the CListCtrl redraws, the available physical memory of the device is decreased by 4kb. i don''t the know the reason why physical memory is decreased. If any one know the answer please let me know. Thanks in advance.
Following is my code snippet.
//MESSAGE_MAP
ON_NOTIFY(LVN_GETDISPINFO, IDC_LISTMENUS, OnLvnGetdispinfoListmenus)
//Timer function
void CDlgHijoMenus::Refrescar(int iRefrescoId)
{
CScreenInfo *ptrScreenInfo;
INT16U uwValue;
CHmiApp * pApp = reinterpret_cast<CHmiApp *>(::AfxGetApp());
CModbusAddrList * pModbusAddrList = CModbusAddrList::Instance();
int iIterPrpal = 0;
ptrScreenInfo = pApp->GetCurrentScreenInfo ()->ptrChild;
while (ptrScreenInfo != NULL)
{
if (ptrScreenInfo->GetOperationCommandInfo () != NULL)
{
uwValue = pModbusAddrList->ReadModbusValue (ptrScreenInfo->GetOperationCommandInfo ()->GetOpCmdModbusAddr ());
if (!ptrScreenInfo->UpdateConditionalHide (uwValue))
{
m_listMenus.RedrawItems(iIterPrpal, iIterPrpal);
iIterPrpal ++;
}
}
else if (!ptrScreenInfo->IsHidden ())
{
m_listMenus.RedrawItems(iIterPrpal, iIterPrpal);
iIterPrpal ++;
}
ptrScreenInfo = ptrScreenInfo->ptrSibling;
}
m_listMenus.SetItemCount (iIterPrpal);
}
//Redrawing function
void CDlgHijoMenus::OnLvnGetdispinfoListmenus(NMHDR *pNMHDR, LRESULT *pResult)
{
LV_DISPINFO* pDispInfo = (LV_DISPINFO*)pNMHDR;
// TODO: Add your control notification handler code here
LV_ITEM *pItem = &(pDispInfo)->item; // Puntero al item
int iItemCount = 0, iItemIndex = pItem->iItem; // Indice del item
CString cstrTexto(_T(""));
CModbusAddrList * pModbusAddrList = CModbusAddrList::Instance();
ManejadorVariables * pmv = ManejadorVariables::Instancia();
CScreenInfo *ptrScreenInfo;
CHmiApp * pApp = reinterpret_cast<CHmiApp *>(::AfxGetApp());
ptrScreenInfo = pApp->GetCurrentScreenInfo ()->ptrChild;
if (pItem->mask & (LVIF_TEXT | LVIF_IMAGE | LVIF_PARAM))
{
if (pItem->iSubItem == 0)
{
while (ptrScreenInfo != NULL)
{
if (iItemCount == iItemIndex)
{
cstrTexto.Format (_T("%s"), ptrScreenInfo->GetDescriptionName (pmv->m_iIdioma));
break;
}
ptrScreenInfo = ptrScreenInfo->ptrSibling;
if ((ptrScreenInfo)&& (!(ptrScreenInfo->IsHidden ()|| ptrScreenInfo->GetConditionalHide ())))
iItemCount ++;
}
pItem->iImage = 0;
lstrcpy(pItem->pszText, cstrTexto);
}
}
*pResult = 0;
}
推荐答案
CModbusAddrList * pModbusAddrList = CModbusAddrList::Instance();
ManejadorVariables * pmv = ManejadorVariables::Instancia();
那些方法如何定义?
How are those methods defined?
这篇关于CListCtrl RedrawItem函数中的问题.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!