NM_CUSTOMBAR returns void, how to use it correctly
-
I use custombar for CTreeView, but I need to return values like in following code
void CMyTree::OnNMCustomdraw(NMHDR *pNMHDR, LRESULT *pResult) { LPNMCUSTOMDRAW pNMCD = reinterpret_cast(pNMHDR); // TODO: Add your control notification handler code here LPNMTVCUSTOMDRAW lptvcd = (LPNMTVCUSTOMDRAW)pNMCD; if(lptvcd==NULL) { return -1; } switch(lptvcd->nmcd.dwDrawStage) { case CDDS_PREPAINT: return CDRF_NOTIFYITEMDRAW; case CDDS_ITEMPREPAINT: CString* cv = new CString("orange"); lptvcd->clrText = (DWORD)cv; return CDRF_NOTIFYSUBITEMREDRAW; }
How to use this function correctly? Thanks in advance, alex:confused: -
I use custombar for CTreeView, but I need to return values like in following code
void CMyTree::OnNMCustomdraw(NMHDR *pNMHDR, LRESULT *pResult) { LPNMCUSTOMDRAW pNMCD = reinterpret_cast(pNMHDR); // TODO: Add your control notification handler code here LPNMTVCUSTOMDRAW lptvcd = (LPNMTVCUSTOMDRAW)pNMCD; if(lptvcd==NULL) { return -1; } switch(lptvcd->nmcd.dwDrawStage) { case CDDS_PREPAINT: return CDRF_NOTIFYITEMDRAW; case CDDS_ITEMPREPAINT: CString* cv = new CString("orange"); lptvcd->clrText = (DWORD)cv; return CDRF_NOTIFYSUBITEMREDRAW; }
How to use this function correctly? Thanks in advance, alex:confused:bilas wrote: CString* cv = new CString("orange"); lptvcd->clrText = (DWORD)cv; That code is using the wrong data types. You need to assign a
COLORREF
, not a string. Look upCOLORREF
and theRGB
macro in MSDN. --Mike-- LINKS~! Ericahist updated! | 1ClickPicGrabber | CP SearchBar v2.0.2 | C++ Forum FAQ Strange things are afoot at the U+004B U+20DD