在光盘上看到一些动态光标文件,后缀名为.ANI,
有非常好的动态效果,请问我在编程中如何读取.ANI文件,
并将它在程序中显示出来?送你50分,说到做到!

解决方案 »

  1.   

    // initialize the cursor array
    _afxCursors[0] = ::LoadCursor(hInst, MAKEINTRESOURCE(AFX_IDC_TRACKNWSE));
    _afxCursors[1] = ::LoadCursor(hInst, MAKEINTRESOURCE(AFX_IDC_TRACKNESW));
    _afxCursors[2] = _afxCursors[0];
    _afxCursors[3] = _afxCursors[1];
    _afxCursors[4] = ::LoadCursor(hInst, MAKEINTRESOURCE(AFX_IDC_TRACKNS));
    _afxCursors[5] = ::LoadCursor(hInst, MAKEINTRESOURCE(AFX_IDC_TRACKWE));
    _afxCursors[6] = _afxCursors[4];
    _afxCursors[7] = _afxCursors[5];
    _afxCursors[8] = ::LoadCursor(hInst, MAKEINTRESOURCE(AFX_IDC_TRACK4WAY));
    _afxCursors[9] = ::LoadCursor(hInst, MAKEINTRESOURCE(AFX_IDC_MOVE4WAY));
    {
    // trackers should only be in client area
    if (nHitTest != HTCLIENT)
    return FALSE; // convert cursor position to client co-ordinates
    CPoint point;
    GetCursorPos(&point);
    pWnd->ScreenToClient(&point); // do hittest and normalize hit
    int nHandle = HitTestHandles(point);
    if (nHandle < 0)
    return FALSE; // need to normalize the hittest such that we get proper cursors
    nHandle = NormalizeHit(nHandle); // handle special case of hitting area between handles
    //  (logically the same -- handled as a move -- but different cursor)
    if (nHandle == hitMiddle && !m_rect.PtInRect(point))
    {
    // only for trackers with hatchedBorder (ie. in-place resizing)
    if (m_nStyle & hatchedBorder)
    nHandle = (TrackerHit)9;
    } //ASSERT(nHandle < _countof(_afxCursors));
    ::SetCursor(_afxCursors[nHandle]);
    return TRUE;
    }
      

  2.   

    兄弟能否把个设计思路给我呢,这样的代码我看的不是很明白呀,请赐教一下。我怎么可以载入一个已经存在的*.ani文件到vc中呢,又怎么捕获到它呢?
      

  3.   

    直接资源里添加光标文件,然后LoadCursor
      

  4.   

    LOADCURSOR可以载入动态光标么,而且我用setpixel画线,我想让让这个动态图标随着这个点移动
    怎么实现呢,最好有源码,多少分都无所谓,可以加分。我qq是38866544,email:[email protected],希望能和各位高手交流!
      

  5.   

    装入光标句柄(在资源中),可用API LoadCursor()来实现。

    LoadCursorFromFile(在文件中)等等。当光标在某一窗口上移动时,系统会发送WM_SETCURSOR消息给目标窗口,
    此时就可以调用SetCursor()来进行更换光标了。
      

  6.   

    丢进资源然后在窗口初始化时LoadCursor加载,最简单的了。
      

  7.   

    to umbrella1984(雨伞(曾国文)):我想用的是一个动态图标,后缀是.ani,怎么放到资源里呢?资源里不是只能存.bmp和.icon这样的图标么?to lianglp() :我的光标并不动,动的是在视图里使用setpixel画的点,我的意思是把画的点,实时地在显示出来,而光标只不过是随着这个点运动在屏幕上来回移动而已,您看有什么办法没有?
      

  8.   

    在您的视图类中加入变量:
    HCURSOR     mAniCursor; 
    然后在构造函数中:(_T("Rotate.ani")为您的光标文件路径)
    mAniCursor=::LoadCursorFromFile(_T("Rotate.ani"));
    在需要用到的地方,(一般在OnSetCursor()中)
    SetCursor(mAniCursor);这只是从文件中load动画光标,从资源中load我也没成功。高手如果知道,不妨来指点一二。