let's say I've got a handler of the wm_paste message in a CEdit descendant:
LRESULT CMyEdit::OnPaste(WPARAM wParam, LPARAM lParam)
{
//do some processing
return 0;
}
and let's say that in some cases I want开发者_如何转开发 to trigger the default behaviour for paste from this method. How do I do it? CEdit::OnPaste does not exist...
Cheers
Call CWnd::DefWindowProc
, passing it WM_PASTE
, wParam
and lParam
.
Typically the OnXxx
handlers in base classes consist of a single line that calls DefWindowProc
-- if CEdit::OnPaste
existed, that's what it would do.
You can also simply call CWnd::Default. This function, which is defined in wincore.cpp, uses _afxThreadState.GetData() to obtain the information on the message that is currently being processed and then calls CWnd::DefWindowProc.
I mention that because if you used the ON_WM_PASTE() macro in the message map and thus have no parameters to the OnPaste function then the solution mentioned by Tim Robinson will not work since there are no wParam and lParam parameters to pass to CWnd::DefWindowProc.
精彩评论