detecting treeview item state change

I have subclassed a treeview, and am trying to detect when an (any) node goes bold. I tried:

static int CALLBACK SubTreeProc(HWND hWnd, UINT wMessage, WPARAM wParam, LPARAM lParam)
{
    LRESULT result;
    HTREEITEM hParent;

    result = CallWindowProc(g_OrgProc, hWnd, wMessage, wParam, lParam);
    if(wMessage == WM_NOTIFY){
        LPNMTREEVIEW  nmtv = (LPNMTREEVIEW)lParam;
        if(nmtv->hdr.code == TVN_SETDISPINFO) {
             MessageBox (NULL, "SetDispInfo!!" , "bkSortFolders", 0);
        }
    }
    return result;
}

...but that doesn't fire when an item goes bold. Reading msdn, it seems I need TVM_SETITEM, and then look for a state change with TVIS_BOLD, but I can't find an example on how to use it. Can anyone help


Answer this question

detecting treeview item state change

  • Viswanand

    I don't know of a way to do this. For more info on TVM_SETITEM/TVIS_BOLD, check out http://www.pinvoke.net/ for more info on interop with Win32.

    -mark
    Program Manager
    Microsoft
    This post is provided "as-is"

  • detecting treeview item state change