devxlogo

April 27, 1999

Reduce the number of DoEvents

Don’t fill your code with unnecessary DoEvents statements, especially within time-critical loops. If you can’t avoid that, at least you can reduce the overhead by invoking DoEvents only every N

GetShortFileName – Convert a filename to 8.3 format

Private Declare Function GetShortPathName Lib “kernel32” Alias _ “GetShortPathNameA” (ByVal lpszLongPath As String, _ ByVal lpszShortPath As String, ByVal cchBuffer As Long) As Long’ Convert a long filename into the

Hide the Automation Manager

If you haven’t switched to DCOM yet, and still use Remote OLE Automation, you must launch the Automation Manager program on the server machine, in order to let the server

Topmost windows

This is an evergreen, but it’s still popular. It is very easy to create a window that always stays on top of the others, thanks to the SetWindowPos API function.

Use the right type for constants

VB stores symbolic and literal constants internally using the simplest data type possible; this means that most common numeric constants-such as zero or one-are stored as Integers. If you use

And is faster the Mod

Use the And operator instead of Mod when the divisor is a number in the form 2^N. For instance, there are two methods to extract the least significant byte in