I would like to customize Windows Explorer.
One thing I want to do is changing file name's color in list view if the file has a special condition.
Is it possible by window subclassing? or does it need api hooking? Please let me know what is the best way to do this.开发者_StackOverflow社区Thanks.
Yes, you can do it with the window subclassing:
Add NM_CUSTOMDRAW handler to your CListCtrl-derived class
void CMyList::OnCustomDraw(NMHDR* pNMHDR, LRESULT* pResult)
{
LPNMLVCUSTOMDRAW lplvcd = (LPNMLVCUSTOMDRAW)pNMHDR;
switch (lplvcd->nmcd.dwDrawStage)
{
case CDDS_PREPAINT:
*pResult = CDRF_NOTIFYITEMDRAW;
break;
case CDDS_ITEMPREPAINT:
*pResult = CDRF_NOTIFYSUBITEMDRAW;
break;
case CDDS_ITEMPREPAINT | CDDS_SUBITEM:
lplvcd->clrText = **MY_COLOR**;
*pResult = CDRF_DODEFAULT;
}
}
精彩评论