CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    May 2000
    Location
    Belgium, Bruges
    Posts
    146

    Using animated cursors

    Hi can anybody help me on using animated cursors in my program??


  2. #2
    Join Date
    May 2000
    Location
    New York, NY, USA
    Posts
    2,878

    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


    Iouri Boutchkine
    [email protected]
    Iouri Boutchkine
    [email protected]

  3. #3
    Join Date
    May 2000
    Location
    Belgium, Bruges
    Posts
    146

    Re: Using animated cursors

    Thank u verry much for this reply, but i need this in a label_mousemove event. Can you help me with this??


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

    Re: Using animated cursors


    'then add this code in general section:
    dim blnload as boolean

    'and use Iouri code in different events:
    private Sub label1_mousemove()
    Dim hCur as Long
    if blnload= false then

    hCur = LoadCursorFromFile("c:\winnt\cursors\metronom.ani")
    hCurOld = SetClassLong(Form1.hwnd, GCL_HCURSOR, hCur)
    blnload = true
    end if
    End Sub

    private Sub Form_mousemove
    Dim hCur as Long
    if blnload = true then
    hCur = SetCursor(hCurOld)
    blnload = false
    end if
    End Sub






    Special thanks to Lothar "the Great" Haensler, Tom Archer, Chris Eastwood, TCartwright, Bruno Paris, Dr_Micahel
    and all the other wonderful people who made and make Codeguru a great place.
    Come back soon, you Gurus.

    The Rater
    ...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.

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