[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Changing Hourglass to Animated one

Posted on 1998-08-14
1
Medium Priority
?
1,756 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

Technology Partners: 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

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
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…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

650 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