August 2, 1997

Evaluating Elapsed Minutes

You might need to keep track of the total minutes between one date or time and another. To get the totalminutes, use a line like this: lTotalMinutes = Minutes(Now) – _ Minutes(datStartTime)This function returns the number of minutes since 01/01/1900:Public Function Minutes(d As Date) _ As Long ‘Minutes since 1900

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 procedureor function? This technique simplifies showing and resetting the MousePointer without adding code to theend of a procedure or function.When you create an object from a class, the Initialize event

Current Computer Name on Windows 95/NT

You often want to know the name of the current computer running Windows 95 or Windows NT in your VB program. Use this simple wrapper function of a kernel32.dll API function to do the job: Private Declare Function GetComputerNameA Lib “kernel32″_ (ByVal lpBuffer As String, nSize _ As Long) As

Show Fonts as you Select Them

To let a user change a font name, load all the fonts into a combo box: Private Sub Form_Load() ‘ Determine the number of screen ‘ fonts. For I = 0 To Screen.FontCount – 1 ‘ Put each font into list box. cboFont.AddItem Screen.Fonts(I) Next IEnd Sub Make this more

Shortcuts for the VB Environment

1) In VB5, pressing Ctrl-F3 when the cursor is over a word automatically searches to the next occurrenceof that word, bypassing the search dialog. You need to be past the first character of the word for it to workproperly.2) VB4/5 Ctrl-Tab cycles through all your open windows in the IDE

Get all Matching Files in a Directory Structure

Because this code doesn’t use an API, you can easily port it between 16- and 32- bit applications. TheDirWalk procedure lets you search an entire directory structure starting at whatever you specify as theargument: ReDim sArray(0) As StringCall DirWalk(“OLE*.DLL”, “C:”, sArray) The procedure accepts wildcards in the first argument, which

Trap Right-Clicks on TreeView’s Nodes

The TreeView control gives your apps a good Windows 95 look and feel. However, the VB manual doesn’texplain how to trap the right mouse button in a node. The Treeview_MouseDown event occurs before theNodeClick event. In order to display context menus over a node, use this code and define the

Getting UserID on Windows 95 and NT

You often want to get the user ID of the current user on the machine running Windows 95 or Windows NT.Use this simple wrapper function of an API function to do the job: Option ExplicitPrivate Declare Function WNetGetUserA _ Lib “mpr” (ByVal lpName As String, _ ByVal lpUserName As String,

Run VB Using the Sendto Menu

Adding a “Shortcut to VB.exe” and “Shortcut to VB32.exe” to your “Send To” menu lets you right-click onany VBP project and open it with your choice of VB4 16/32 or VB5.Go to your VB directory, right-click on VB32.exe, and choose “Create shortcut.” When the shortcut file iscreated, move it into

No more posts to show