WHEN SHOULD NOT WE CALL THE BASE CLASS'S CORRESPONDING FUNCTION?

xiaoxiao2021-03-06  60

20041206: WHEN SHOULD NOT WE CALL THE BASE CLASS'S CORRESPONDING FUNCTION?

void CDropDownBotton :: OnKeyDown (UINT nChar, UINT nRepCnt, UINT nFlags) {// TODO: Add your message handler code here and / or call default if (nChar == VK_RETURN || nChar == VK_ESCAPE) {if (m_pOrigParent-> Isdropdowndialogdown ()) m_porigparent-> onDropdownButton ();} // cbutton :: onkeydown (nchar, nrepcnt, nflags);}

in the code snippet above, the base class's corresponding function CButton :: OnKeyDown (nChar, nRepCnt, nFlags); is comment out.The reason is that the CButton has already been destroyed before we call CButton :: OnKeyDown.

Another Way To Fix This Kind of bug is to call cwnd :: postmeassage () instead of calling method to design.

转载请注明原文地址:https://www.9cbs.com/read-84080.html

New Post(0)