?
Solved

Changing Hourglass to Animated one

Posted on 1998-08-14
1
Medium Priority
?
1,750 Views
Last Modified: 2010-05-18
I know that i can replace the pointer with an .ani file of an animated hourglass instead of the typical hourglass that represents "waiting" but is there  a way to tell my entire vb app to show this animated hourglass whenever it is about to use the ordinary hourglass ie. when i call the commondialog's open box it displays the w95 predefined hourglass (as set in the Control Panel's mouse options).  I want to make sure that ALL of these hourglasses are the animated one instead.  How would i go about doing this without making repeated calls seen below throughout my program:

form.mousepointer = 99 'i believe this is the user defined type
form.mouseicon = LoadIcon("Ani-HourGlass.ani") 'i think it is loadicon

'code that i want to display with the animated hourglass goes here

form.mousepointer=0 'turn off animated hourglass and display default pointer
0
Comment
Question by:ratboy2
[X]
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
1 Comment
 
LVL 1

Accepted Solution

by:
DennisH earned 400 total points
ID: 1468866
Try This,

Put these declarations in a standard module.

'WinAPI32 call
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

'WinAPI32 constant
Public Const GCL_HCURSOR = (-12)

'Two global variables to hold the cursors
Global hCursor as long
Global hOldCursor as long


To create the animated cursor (in your startup form module):

Private Sub SetAniCursor(strPath as string)
   
    hCursor = LoadCursorFromFile(ByVal strPath)
    hOldCursor = SetClassLong(Me.hwnd, GCL_HCURSOR, hCursor)

End Sub

To restore the old cursor when you are done

Private Sub ResetAniCursor()

    hCursor = SetClassLong(Me.hwnd, GCL_HCURSOR, hOldCursor)

End Sub

Another approach might be to use the WinAPI32 call "CreateCursor" to create a cursor that has application-wide scope.  See the Win32 SDK for more information.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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

770 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