Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


Animated cursors...

Posted on 1999-06-28
Medium Priority
Last Modified: 2010-05-18
VB alows us to change cursor for example into hourglass when longer task performs. I noticed that it doesn't support animated cursos... smahe. Does anyone of you know how could I simply change cursor to animated one when longer task starts?

Question by:hpet
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 14

Accepted Solution

waty earned 100 total points
ID: 1520184
' #VBIDEUtils#************************************************************
' * Programmer Name  : Waty Thierry
' * Web Site         :
' * E-Mail           :
' * Date             : 28/06/99
' * Time             : 13:19
' **********************************************************************
' * Comments         : Using animated cursors
' *
' *
' **********************************************************************

Option Explicit
Public Const GCL_HCURSOR = -12
Declare Function ClipCursor Lib "user32" (lpRect As Any) As Long
Declare Function DestroyCursor Lib "user32" (ByVal hCursor As Any) As Long
Declare Function LoadCursorFromFile Lib "user32" Alias_ "LoadCursorFromFileA" (ByVal lpFileName As String) As Long
Declare Function SetClassLong Lib "user32" Alias "SetClassLongA" (ByVal_ hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Declare Function GetClassLong Lib "user32" Alias "GetClassLongA" (ByVal_ hwnd As Long, ByVal nIndex As Long) As Long

Private Sub Command1_Click()
   Dim lResult As Long
   Dim mhAniCursor As Long
   Dim mhAniCursor2 As Long
   mhAniCursor = LoadCursorFromFile("C:\windows\cursors\globe.ani")
   lResult = SetClassLong((hwnd), GCL_HCURSOR, mhAniCursor)
   state = 1
   mhAniCursor2 = LoadCursorFromFile("C:\windows\cursors\hourglas.ani")
   lResult = SetClassLong((Text1.hwnd), GCL_HCURSOR, mhAniCursor2)
   state = 1
End Sub

Private Sub Command2_Click()
   Dim lResult As Long
   lResult = SetClassLong((hwnd), GCL_HCURSOR, mhBaseCursor)
   lResult = DestroyCursor(mhAniCursor)
   lResult = SetClassLong((Text1.hwnd), GCL_HCURSOR, mhBaseCursor2)
   lResult = DestroyCursor(mhAniCursor2)
   state = 0
End Sub

Private Sub Form_Load()
   mhBaseCursor = GetClassLong((hwnd), GCL_HCURSOR)
   mhBaseCursor2 = GetClassLong((hwnd), GCL_HCURSOR)
End Sub


Expert Comment

ID: 1520185
Visual Basic supportes only a valid graphics file.
(i.e. bitmap, icon, Windows metafile ...) to the Picture property of a form or control.

So maybe you can, but only with a 3rd party - I guess...


Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question