There are several new articles available at http://www.codeoftheweek.com/bonus/articles.html
Download a free copy of NetMon - Your Internet Performance Monitor at http://www.codeoftheweek.com/netmon/index.html
Subscribe to Code of the Week for only $14.95 (regularly $19.95). Just jump to our SECRET order page at http://www.codeoftheweek.com/orderforms/annual1495.html
In this issue we are introducing a class module that shows an easy way to handle the hourglass mouse cursor (or any other cursor).
This source code is designed for VB 5.0 and up. Similar methods can be used in VB 4.x. Questions? Email us at email@example.com.
The cMouseCursor class provides an easy method for displaying the Hourglass cursor during time-consuming tasks. You simply declare the object and call StartTask.
If you have any questions about using or creating this control, let us know at firstname.lastname@example.org
Public Sub StartTask(Optional MouseCursor As MousePointerConstants = vbHourglass)
This subroutine will show the mouse cursor you specify as a parameter or the default of vbHourglass.
Public Sub StopTask()
StopTask is the nice way to make the original mouse cursor reappear after completing your time-consuming task. If you declare the cMouseCursor object within a local subroutine then you skip calling this because the Terminate event of the class will automatically do so for you. It is good programming practice to call this method.
No return values in this class.
The below sample describes how to use the cMouseCursor class.
Dim mc As New cMouseCursor ' vbHourglass is the default so it is optional. We specified it here ' to show how you would do this. See the source for all the available ' options. mc.StartTask vbHourglass ' Do some time consuming task here. mc.StopTask
To see the source code for this issue you must be a subscriber to Code of the Week. If you are a subscriber the source code is available at the following address: http://www.codeoftheweek.com/membersonly/bi/0074.html