为什么收不到WM_CHAR消息
我做了一个从CWnd继承的类 CTestWnd,响应两个消息
void CTestWnd::OnLButtonDown(...)
{
SetFocus() ;
}
void CTestWnd::OnChar( UINT nChar, UINT nRepCnt,UINT nFlags )
{
MessageBox("hello") ;
}
在一个对话框中创建他的一个实例,并在OnInitDialog中创建:
BOOL CTestDlg::OnInitDialog()
{
...
m_testWnd.Create( NULL , NULL , WS_CHILD | WS_VISIBLE | WS_TABSTOP ,rc, this , ID_TEST) ;
}
当焦点到CTestWnd窗口后,按一个字符键,跟踪时发现根本没有进入CTestWnd::OnChar(),后来试了一下,WM_KEYDOWN和WM_KEYUP都能接受到。
请问是怎么回事,请赐教。