dcsimg
Login | Register   
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.


Tip of the Day
Language: Visual Basic
Expertise: Advanced
Aug 1, 1997

WEBINAR:

On-Demand

Application Security Testing: An Integral Part of DevOps


Show an Hourglass When Processing Data

Have you ever forgotten to add code to set the MousePointer back to its default at the end of a procedure or function? This technique simplifies showing and resetting the MousePointer without adding code to the end of a procedure or function. When you create an object from a class, the Initialize event is generated. Any code in the event procedure for that event then executes. This is the first code to execute for the object, before you set any properties or invoke any methods. When the variable goes out of scope, all references to the object are released, the Terminate event is generated for the object, and any code in the Terminate event procedure for that object is executed:
 
Declare Sub Sleep Lib "kernel32" _
        (ByVal dwMilliseconds As Long)

' this is an example of a procedure that
' uses the CHourGlass class
Private Sub ProcessData()
        Dim MyHourGlass As CHourGlass
        Set MyHourGlass = New CHourGlass
        'Add processing code here
        Sleep 5000 'This simulates the 
        'processing of data
        'Resume processing code here
End Sub

'Create a CHourGlass class with the 
'following code:
Private Sub Class_Initialize()
        'Show HourGlass
        Screen.MousePointer = vbHourglass
End Sub

Private Sub Class_Terminate()
        'Restore MousePointer
        Screen.MousePointer = vbDefault
End Sub
Kurt D.
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
×
We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.
Thanks for your registration, follow us on our social networks to keep up-to-date