devxlogo

April 20, 1999

IsWindowsNT – Check Windows platform

Private Declare Function GetVersion Lib “kernel32” () As Long’ Returns True is executed under Windows NT,’ False if executed under Windows 95/98Function IsWindowsNT() As Boolean IsWindowsNT = (GetVersion() And &H80000000)

WindowsVersion – The version number of the operating system

Private Type OSVERSIONINFO dwOSVersionInfoSize As Long dwMajorVersion As Long dwMinorVersion As Long dwBuildNumber As Long dwPlatformId As Long szCSDVersion As String * 128End TypePrivate Declare Function GetVersionEx Lib “kernel32” Alias

Enhanced For-Next loops

At times you may need to execute the same block of statements for different values of a variable, but you can’t use a straight For Next loop because the sequence

Fixed-length strings allocate and deallocate faster

Fixed-length strings are generally slower than conventional strings, because all VB string functions and operators only recognize conventional strings, thus all fixed-length strings must be transparently converted to and from

Load a text file in one operation

The fastest way to read a text file is using the Input$ function, as shown in this reusable procedure: Function FileText (filename$) As String Dim handle As Integer handle =

Multiple compilation constants

Visual Basic’s documentation does not explain how to specify more than just one conditional compilation constant in the Advanced tab of the Options dialog. The correct way is using a