1.將想要加入的Cursor(.cur檔)加入專案中
2.在類別下的MemberData中加入一個HCURSOR類別的成員(在此使用的名稱為 m_hNoDrop)
protected:
HCURSOR m_hNoDrop;
3.在類別建構子中加入以下指令
m_hNoDrop = AfxGetApp()->LoadCursor( IDC_NODROP );
註:IDC_NODROP為欲加入的cursor ID
4.在欲改變指標的區段加入
SetCursor( m_hNoDrop );
5.建立事件OnSetCursor:功能表中的View\MFC ClassWizard下,Object IDs選擇專案名稱,Messages選擇WM_SETCURSOR再選擇Add Function即可。
BOOL Your_Project_Name::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)
{
// TODO: Add your message handler code here and/or call default
return true;
}
註:1.須使該事件的回傳值為ture
2.Your_Project_Name為您的專案名稱