我用以下代码改变了鼠标图标:
HCURSOR hc,ohc;
hc=LoadCursorFromFile("d.cur");
ohc=SetCursor(hc);
ShowCursor(1);
Sleep(1000);
但只过了一秒就变回原来的鼠标了,
加了SetCapture()可以长期保持鼠标的图标不变回去,
但对话框上的按钮全按不动了,
怎么办?

解决方案 »

  1.   

    在WM_SETCURSOR消息处理函数中写你的代码
      

  2.   

    响应WM_SETCURSOR消息
    CPoint curPt;
    ::GetCursorPos(&curPt);
    ScreenToClient(&curPt); CRect cntRect(m_barClientRect);
    cntRect.left = m_cxIEBar - 10;
    cntRect.right = cntRect.left + 10; HCURSOR hCursor = NULL;
    if(cntRect.PtInRect(curPt))
    {
    hCursor = AfxGetApp()->LoadStandardCursor(IDC_SIZEWE);
    }
    else
    {
    hCursor = AfxGetApp()->LoadStandardCursor(IDC_ARROW);
    }
    ::SetCursor(hCursor);
      

  3.   

    就是在WM_SETCURSOR消息中加载你的光标!
      

  4.   

    HCURSOR hCursor;
    HWND hwnd;
    ......
    SetClassLong(hwnd , GCL_HCURSOR , (Long)hCursor)