tags:

views:

15

answers:

1

Current, I have a parent CWnd, which is displaying many other child CWnds. All my message handling job are being done in parent CWnd, as I do not have access to child CWnds' code.

I wish to know which child CWnds is being clicked.

I can detect the right click

afx_msg void OnContextMenu(
   CWnd* pWnd,
   CPoint pos 
);

pWnd will be the clicked child window.

However, how about left click? I know I can get the mouse coordinate, and perform some calculation accordingly to iterate through see which child CWnds falll into the point. However, I just don't want to go through all this. I which I can have something like.

CWnd* childWind = mouseEvent.getParent();
+1  A: 
CWnd* me = ChildWindowFromPoint(point);
Yan Cheng CHEOK