Small CTreeCtrl problem

Hello,

I have the following type of project:
I have an activeX creating a form. In this form, I have add a CTreeCtrl.

I have my own class wrapper on this CTreeCtrl to manage the item generation and a kind of memory manager (avoid memory duplication). I want to add a context menu to the CTreeCtrl class child.

My OnContextMenu function is:

void CTree::OnContextMenu(CWnd* pWnd, CPoint point)
{
UINT uCmd = m_lpwndContextMenu->TrackPopupMenu(TPM_LEFTALIGN |
TPM_RIGHTBUTTON, point.x, point.y,
AfxGetMainWnd(), NULL);
}

This code works on a normal MFC application but doesn't work anymore in my class/project structure. Can somebody tell me where I can get the Wnd* from the CTreeCtrl. If my memory is good, the CTreeCtrl is child of CWnd... and I should be able to pass this pointer directly?
[880 byte] By [sbouchard] at [2007-11-17 11:49:22]