基于对话框的应用程序为什么不能处理按键消息
编号:QA004066
建立日期: 2001年4月4日 最后修改日期:2001年4月4日
所属类别:
wjb:
基于对话框的应用程序为什么不能处理按键消息?
WIN98 VC++6
程序:
void CTmpDlg::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
{
SetWindowText("wjb");
CDialog::OnChar(nChar, nRepCnt, nFlags);
}
可窗口标题就是不改变。
回答:
消息被送给对话框中的控件了。你可以在PreTranslateMessage中处理消息,如:
BOOL CTmpDlg::PreTranslateMessage(MSG* pMsg)
{
// TODO: Add your specialized code here and/or call the base class
if(pMsg->message == WM_CHAR)
{
SetWindowText("wjb");
}
return CDialog::PreTranslateMessage(pMsg);
}
此问题由李海回答。
| |
|
|
| |
|
|