变量:
HCURSOR m_hButtonCursor;
重载函数:
afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT msg);
函数实现:
BOOL CMyDialog::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT msg) { CString sClassName; ::GetClassName(pWnd->GetSafeHwnd(),sClassName.GetBuffer(80),80); if (sClassName=="Button" && m_hButtonCursor) { ::SetCursor(m_hButtonCursor); return TRUE; } return CDialog::OnSetCursor(pWnd, nHitTest, msg); }