怎么把一个类从无基类变为从CWND继承呢。
lvcjh 2003-05-21 05:44:47 我原有一个类CMonitor无基类,现原为要处理消息,把它变为从CWnd中继承过来,
请问怎么改才可以使用Timer事件。
.h中增加
//{{AFX_MSG(CMonitor)
afx_msg void OnTimer(UINT nIDEvent);
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
.cpp中增加
BEGIN_MESSAGE_MAP(CMonitor, CWnd)
//{{AFX_MSG_MAP(CMonitor)
ON_WM_TIMER()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
void CMonitor::OnTimer(UINT nIDEvent)
{
AfxMessageBox("timer");
}
int CMonitor::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CMonitor::OnCreate(lpCreateStruct) == -1)
return -1;
// TODO: Add your specialized creation code here
SetTimer(1,500,NULL); //怎么没反回呢,加在什么地方可以开始时钟
return 0;
}
现在一点反映也没有,编译没出错。