المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : capturing notify messages



C++ Programming
05-07-2009, 08:12 PM
ok, so i have a dialog, which i'll call CMainDlg.

CMainDlg has a regular CSplitterWnd with two columns.

the splitter has two CWnd derived objects in it, which i'll call CNewWnd



so here's how i created them:

(inside CMainDlg's onInitDialog)

CCreateContext* con = new CCreateContext();
con->m_pNewViewClass = RUNTIME_CLASS(CNewWnd);

splitter.CreateStatic( this, 1, 2, WS_VISIBLE);
splitter.CreateView(0,0, con->m_pNewViewClass, CSize(200, 200), con);
splitter.CreateView(0,1, con->m_pNewViewClass, CSize(200, 200), con);



that creates the splitters, and the stuff inside them, everything works perfectly, except for the fact that i can't seem to catch the messages from the CNewWnd using ON_NOTIFY


so the problem is, ON_NOTIFY requires the DlgCtrlID like this:
ON_NOTIFY(NM_CLICK, IDD_DLG, func)

but i dont have that value cause the CNewWnd objects are created dynamically



i tried using SetDlgCtrlID() on the CNewWnd objects but it seems to crash the splitter

i also tried sending custom ids using SendMessage but it's not getting caught

(inside CMainDlg)
ON_NOTIFY(NM_CLICK, 15, func)
splitter.GetPane(0, 0)->m_customid = 15;

(inside CNewWnd)
GetOwner->SendMessage(WM_NOTIFY, (WPARAM) m_customid, (LPARAM)hdr);



any suggestions? thanks