dcsimg
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7

Thread: How to display windows-animated-cursor (ani file)?

  1. #1
    Join Date
    Nov 2005
    Posts
    7

    Question How to display windows-animated-cursor (ani file)?

    Hi everyone!
    I want to display/draw/animate (not as a cursor) more than one windows-animated-cursor (ani file) at the same time. Can anyone show me sample windows api/directx api code to displaying/drawing windows-animated-cursor?
    E.g. draw ani cursor in child-window/desktop area.
    Is it posible to draw ani file as animation without manual drawing (not use FOURCC)?
    Thanks.
    Last edited by indra.settyo; November 21st, 2005 at 08:02 PM.

  2. #2
    Join Date
    May 2005
    Posts
    4,954

    Re: How to display windows-animated-cursor (ani file)?

    Quote Originally Posted by indra.settyo
    Hi everyone!
    I want to display more than one windows-animated-cursor (ani file) at the samte time. Can anyone show me sample windows api/directx api code to displaying/drawing windows-animated-cursor?
    Thanks.
    Displaying Animated Cursors from a Resource File

    Cheers
    If a post helped you dont forget to "Rate This Post"

    My Article: Capturing Windows Regardless of Their Z-Order

    Cheers

  3. #3
    Join Date
    Nov 2005
    Posts
    7

    Re: How to display windows-animated-cursor (ani file)?

    Thanks a lot for your suggestion golanshahar, but i mean sample code to display/draw/animate ani file not as a cursor (e.g draw ani cursor in child-window/desktop area). Is it posible without manual drawing (e.g. not use FOURCC)? Any suggestion? I wait for your suggestion.
    Thanks.
    Last edited by indra.settyo; November 21st, 2005 at 07:59 PM.

  4. #4
    Join Date
    Aug 2004
    Posts
    294

    Re: How to display windows-animated-cursor (ani file)?

    Use a static control with style SS_ICON and
    Code:
    SendDlgItemMessage(hDlg, IDC_STATICn, STM_SETIMAGE, IMAGE_CURSOR, (LPARAM) hCursor);
    Boris Karadjov
    Brainbench MVP for Visual C++
    http://www.brainbench.com/

  5. #5
    Join Date
    Nov 2005
    Posts
    7

    Re: How to display windows-animated-cursor (ani file)?

    Quote Originally Posted by Boris K K
    Use a static control with style SS_ICON and
    Code:
    SendDlgItemMessage(hDlg, IDC_STATICn, STM_SETIMAGE, IMAGE_CURSOR, (LPARAM) hCursor);
    Thanks to Boris K K. But how to animate/draw in another control e.g. button, listview?

  6. #6
    Join Date
    Aug 2004
    Posts
    294

    Re: How to display windows-animated-cursor (ani file)?

    How you animate a part of a standard Windows control may vary depending on the type of the control. But in all cases you will have to create a timer, which will define the frame change rate.

    Button: You can either use BS_BITMAP and send BM_SETIMAGE to change the frame being displayed or BS_OWNERDRAW and invalidate a part of the button (or the whole button) whenever a new frame needs to be shown. Naturally, in the second case the code that implements the drawing must be aware of the index of the frame that should be displayed next.

    List view: Again there are at least two possibilities - create an image list, which contains all frames from the cursor animation and use TVM_SETITEM with TVIF_IMAGE flag or handle NM_CUSTOMDRAW for the animated item.

    You can draw a specific frame from the cursor animation using DrawIconEx API function. However for obtaining the frame rate, custom delays for each frame and custom sequence of frames (those are all features of the .ani file), you will have to read and interpret the .ani file yourself (possibly with a little help from Multi-medai I/O API).
    Boris Karadjov
    Brainbench MVP for Visual C++
    http://www.brainbench.com/

  7. #7
    Join Date
    Nov 2005
    Posts
    7

    Re: How to display windows-animated-cursor (ani file)?


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)