I am using the explorer type interface with a treeview on the left and listview on the right side. I added right click context menu support for my treeview. When I right click treeview item, I need to do something in my listview. The problem is while the focus is on the treeview I can't seem to make some normal function call work. for example, GetListCtrl()->GetItemCount always returns 0 value.

I was trying to fix this problem by setting listview as the active view:

////////////////////////////////////////////////////////////////////////////////////////////////
CMyListView* pChildView;
GetParentFrame()->SetActiveView(pChildView, TRUE); // assertion failed error right here!!!

GetListCtrl()->GetItemCount( );
////////////////////////////////////////////////////////////////////////////////////////////

So what should I do to set focus to my listview?

Thanks,
Coco