在CMainFrame::PreCreateWindow 中加入如下:
WNDCLASS wndcls;
::GetClassInfo(AfxGetInstanceHandle(),cs.lpszClass,&wndcls);
wndcls.hbrBackground=(HBRUSH)GetStockObject(BLACK_BRUSH);
wndcls.hCursor=LoadCursor(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDC_CURSOR1)); 
::AfxRegisterClass(&wndcls);
为什么不能成功,呀!
AFXGETAPP->LAODCURSOR(IDC—CURSOR)也不行呀?

解决方案 »

  1.   

    HICON hIcon  = AfxGetApp()->LoadIcon(IDR_FORMTYPE);
    SetIcon(hIcon,true);
    IDR_FORMTYPE
    自定义的光标资源
    中CMainFrame的OnCreate中
    改变程序左上角的光标
      

  2.   

    HCURSOR m_hCursor = AfxGetApp()->LoadCursor(IDC_CURSOR);
    ::SetCursor(m_hCursor);
      

  3.   

    SetCursor(AfxGetApp()->LoadCursor(IDC_CURSOR_HMI));
      

  4.   

    在对话框/窗口/你需要的地方加上对WM_SETCURSOR消息的处理.
    BOOL MyDialog::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)
    {
        // TODO: Add your message handler code here and/or call default
        ::SetCursor(AfxGetApp()->LoadCursor(IDC_MYCURSOR));
        return TRUE;
        //return CDialog::OnSetCursor(pWnd, nHitTest, message);
    }
      

  5.   

    LoadIcon与SetIcon.
    如果只想用等待光标,拥CWaitCursor更为方便