RSUtilities Component

About the Component

The RSUtilities component provides a simple interface to many Win32 API and Shell functions. Among other things, you can easily:

The control is simple to use - have a look at the simple examples below, and download the example application to demonstrate some further functionality.

Instantiating the Component

You can instantiate the component using either early or late binding, but I'd suggest using early binding so you have access to the Auto Complete functionality in Visual Basic:

Dim WithEvents Utils as RSUtilsLib
Sub Form_Load()
Set Utils = New RSUtilsLib
' Now you can use the component
Utils.ShowAbout
End Sub

The Interface

The following Methods, Properties and Events are available from this Component:

AbortFileSearch Stops an File Search that is currently in progress.
BrowseForFolder Displays the standard Windows dialog to allow selection of a single folder within the complete shell namespace (i.e. from My Computer down to individual files)
CompactPath Limits the length of the supplied path to the size (in twips) of the specified control. The reduction in length will be intelligent and follow the same pattern as Windows explorer (e.g. "C:\SomeDir\...\Prog.exe")
EmptyRecycleBin Simply empties the recyle bins on all drives - this works under Windows 2000 as well!
GetLastDLLErrorMessage Returns the text of the last error message that occured within a DLL - this is useful for quickly determining errors in Win32 calls from VB.
GetLocalFileTimes Gets the 3 file times (Creation Time, Last Access Time and Last Write Time) of a file - these will be returned in Local Time.
GetTempFilename Returns a filename which is guaranteed unique and within the system temporary files folder. A prefix can be specified.
HandleInputEvents Similar to DoEvents, this function checks for input events from the Mouse and Keyboard and yields processing to handle these - good for allowing user interaction in long operations.
IsIDE Returns True if the project is currently running in the VB Integrated Development Environment (i.e. in Design Mode), and False if the project is be executed as an EXE/DLL file.
OpenControlPanel Opens the Windows Control Panel
OpenExplorerModeDrive Opens Explorer, pointing to a specified drive, in Explorer mode - i.e. with the Folder panel on the left side.
OpenTaskManager Opens the Task Manager (under Windows NT and Windows 2000).
SearchFiles Searches all subdirectories for a files of a specified search pattern (e.g. "*.htm*"), returning the results in a collection.
SetLocalFileTimes CSets the 3 file times (Creation Time, Last Access Time and Last Write Time) of a file - these will be specified in Local Time.
ShExecute Executes a file, or opens a document with the default associated application - exactly as if the file had been opened with Windows Explorer
ShowAbout Displays the About box for this component
Wait Waits for specified number of seconds (resolution of a Single value) - allowing events to be processed during the wait.
FileFound Occurs every time a file has been found during a SearchFiles function
SearchingDir Occurs every time a new subdirectory is selected for searching during a SearchFiles function

Page Last Updated on Thursday March 18, 2004