发送通知消息给父母 [英] Send a notification message to the parent
本文介绍了发送通知消息给父母的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想知道在CRecordView
父视图上发生CEdit
控件和CDateTimeCtrl
控件更改事件时使用哪个功能之一:
BOOL CMyView::OnChildNotify(UINT message, WPARAM wParam, LPARAM lParam, LRESULT* pLResult) { // TODO: Add your specialized code here and/or call the base class return CRecordView::OnChildNotify(message, wParam, lParam, pLResult); }
或
BOOL CMyView::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo) { // TODO: Add your specialized code here and/or call the base class return CRecordView::OnCmdMsg(nID, nCode, pExtra, pHandlerInfo); }
或
BOOL CMyView::OnCommand(WPARAM wParam, LPARAM lParam) { // TODO: Add your specialized code here and/or call the base class return CRecordView::OnCommand(wParam, lParam); }
或
BOOL CMyView::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult) { // TODO: Add your specialized code here and/or call the base class return CRecordView::OnNotify(wParam, lParam, pResult); }
当某些CEdit
控件上发生更改事件时,我正在使用相同的代码,因此最好的解决方案是使用上述功能之一,但我不知道它们之间的区别(哪种情况适合这种情况?)
我也有一些CDateTimeCtrl
控件
请帮我:((
解决方案
根据 ^ ],它作为命令消息发送.有一个用于编辑控件更改的特殊消息映射处理程序ON_EN_CHANGE,它接受afx_msg void OnChangeMyEdit();
处理程序方法. /blockquote>
I am wondering which one of this functions to use when a
CEdit
control and aCDateTimeCtrl
control change events occures on anCRecordView
parent view:
BOOL CMyView::OnChildNotify(UINT message, WPARAM wParam, LPARAM lParam, LRESULT* pLResult) { // TODO: Add your specialized code here and/or call the base class return CRecordView::OnChildNotify(message, wParam, lParam, pLResult); }
or
BOOL CMyView::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo) { // TODO: Add your specialized code here and/or call the base class return CRecordView::OnCmdMsg(nID, nCode, pExtra, pHandlerInfo); }
or
BOOL CMyView::OnCommand(WPARAM wParam, LPARAM lParam) { // TODO: Add your specialized code here and/or call the base class return CRecordView::OnCommand(wParam, lParam); }
or
BOOL CMyView::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult) { // TODO: Add your specialized code here and/or call the base class return CRecordView::OnNotify(wParam, lParam, pResult); }
I am using the same code when a change event occurs on someCEdit
controls, so the best solution is use one of the above functions, but I don''t know the deference between them (Which one fit in this situation ?)
I also have someCDateTimeCtrl
controls
Help me please :((解决方案According to the documentation on EN_CHANGE[^], it''s sent as a command message. There is a special message map handler for edit control changes, ON_EN_CHANGE, which accepts aafx_msg void OnChangeMyEdit();
handler method.
这篇关于发送通知消息给父母的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文