CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Mar 2000
    Location
    Arizona, USA
    Posts
    493

    Using Animated Cursors

    Can you use animated cursors with the Screee.MouseIcon property?
    I know how to use whatever cursor you want using the LoadPicture function or using a resource
    file. But I would like to use Animated Cursors as well (*.ani).
    Has anyone ever done this or have any ideas?
    Thanks!!!


    Kris
    Software Engineer
    Phoenix,AZ
    Kris
    Software Engineer
    Phoenix, AZ USA

  2. #2
    Join Date
    May 2001
    Location
    Russia
    Posts
    200

    Re: Using Animated Cursors


    private Declare Function LoadCursorFromFile Lib "user32" Alias "LoadCursorFromFileA" (byval lpFileName as string) as Long
    private Declare Function SetClassLong Lib "user32" Alias "SetClassLongA" (byval hwnd as Long, byval nIndex as Long, byval dwNewLong as Long) as Long
    Const GCL_HCURSOR = (-12)

    Dim hCurOld as Long

    private Sub Form_Load()
    Dim hCur as Long
    hCur = LoadCursorFromFile("c:\winnt\cursors\metronom.ani")
    hCurOld = SetClassLong(Form1.hwnd, GCL_HCURSOR, hCur)
    End Sub

    private Sub Form_Unload(Cancel as Integer)
    Dim hCur as Long
    hCur = SetCursor(hCurOld)
    End Sub




    Andy Tower

  3. #3
    Join Date
    Jul 2000
    Location
    Milano, Italy
    Posts
    7,726

    Re: Excelent!

    You deserve a ten, but I am out of votes...!


    Special thanks to Lothar "the Great" Haensler, Tom Archer, Chris Eastwood, Bruno Paris and all the other wonderful people who made and make Codeguru a great place. Come back soon, you Gurus.
    ...at present time, using mainly Net 4.0, Vs 2010



    Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
    all the other wonderful people who made and make Codeguru a great place.
    Come back soon, you Gurus.

  4. #4
    Join Date
    Mar 2000
    Location
    Arizona, USA
    Posts
    493

    Re: Using Animated Cursors

    Thank you for the code. It works great.
    What is the code for the SetCursor function?
    It is called in the Form_Unload event but I don't
    know what the code is so I get an error.

    Kris
    Software Engineer
    Phoenix,AZ
    Kris
    Software Engineer
    Phoenix, AZ USA

  5. #5
    Join Date
    May 2001
    Location
    Russia
    Posts
    200

    Re: Using Animated Cursors

    Delete all Form_Unload code. Sorry, this is only test SetCursor function. This function not working in VB and i found other way to create cursor.

    Andy Tower

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured