The new vbAccelerator Site - more VB and .NET Code and Controls
 Source Code
1 ActiveX Controls &nbsp
&nbsp

Animated Cursor Free-Threaded In-Progress Indicator

 
 

An animated In-Progess Indicator using cursors which doesn't Stop just because VB does

 
 
Animated Cursor In-Progress Indicator

Download Code
VB5 code Download the InProgress AniCursor Component Only (23kb)
VB5 code Download the AniCursor InProgress demonstration project (requires the component first) (14kb)
VB5 code Download the full AniCursor InProgress Component source including demonstration (66kb)

&nbsp Source Code Note &nbsp
&nbsp This DLL is a binary compatible component which works with all other samples. If you compile your own copy of this DLL yourself please make sure you change the name and ProgID. See disclaimer and license for more details. &nbsp
&nbsp NOTE! You cannot run the source code of the demonstration project group in the IDE because of the way VB manipulates ProgIDs and CLSIDs in the IDE. The only way to run this code is to compile the DLL and then use that. &nbsp
&nbsp Before you Begin &nbsp
&nbsp The control project also requires the API Calls used for threading (threadapi.tlb) when running in the IDE. Make sure you have downloaded and registered this before trying the project. &nbsp
 

&nbsp
Overview
This sample provided a free-threaded In-Progress indicator which animates an Animated Cursor, loaded either from a file or from a resource. When running, the control takes very little processor time away from the main task.

The component is implemented in a DLL (vbalPrAn.DLL) and so has no UI itself. The code actually draws into a specified VB PictureBox control. To use the component, simply create an instance of the cAniProgress class and then set the properties:

Property Description
BackColor Gets/sets the colour drawn in the background of the control.
FileName Gets/sets the name of an animated cursor file to be used to load the cursor from if the ResourceID property is set to -1.
hWnd Gets/sets the hWnd of the PictureBox the component will draw to.
Interval Gets/sets the time between frames of the animated cursor (in ms).
ResourceID Gets/sets the identifier of a animated cursor resource within the module with handle hInstance. Set to -1 to use the FileName property instead. Ensure you set the ResourcehInstance property before
ResourcehInstance   Sets the module handle in which to look for the resource specified in ResourceID. Use App.hInstance if the resource is in the executable which owns the object.
If the resource is in an external DLL you must use the API call LoadLibrary to get a hInstance handle, and this must be freed when you close the executable with FreeLibrary.
Note that local resources cannot be read when running in the VB IDE.
Running Gets/sets whether the animation is running or not.


To create an animated cursor resource, you can use the Microsoft Resource Compiler tool (RC.EXE). If you don't already own this, it can be downloaded from the MSDN Visual Basic Owner's Area by downloading the VB5 Resource Add-In. Each resource type has its own unique type; Animated Cursors are stored under type 21 which has the constant ANICURSOR in RC.EXE.




TopBack to top
Source Code - What We're About!Back to ActiveX Control Source Code
Source Code - What We're About!Back to Source Code

&nbsp
 

About  Contribute  Send Feedback  Privacy

Copyright © 1998-1999, Steve McMahon ( steve@vbaccelerator.com). All Rights Reserved.
Last updated: 15 November 1999