Tip Bank

DevX

Using CoInitialize()

CoInitialize() should be called for each thread in the application that makes COM calls. Not just once at application startup.

DevX

Option Explicit

Many developers code text boxes to only accept numeric values. They usually forget about keyboard and mouse copy and paste functions. The following code only allows values 1 to 9

DevX

The Paint Protocol

The AWT Component.paint and Component.update methods take a Graphics object as a parameter. This object should not be retained, because it might be a transient object valid only during the

DevX

Create a List of Months

The following code creates an array with month names or populates a combobox or listbox with same = without all the typing: holdMonth(1) =

DevX

SetWallPaper – Change the desktop’s wallpaper

Private Function SystemParametersInfo Lib “user32” Alias _ “SystemParametersInfoA” (ByVal uAction As Long, ByVal uParam As Long, _ ByVal lpvParam As Any, ByVal fuWinIni As Long) As LongConst SPI_SETDESKWALLPAPER = 20′

DevX

SearchFileOnPath – Search a file on system path

Private Declare Function SearchPath Lib “kernel32” Alias “SearchPathA” (ByVal _ lpPath As String, ByVal lpFileName As String, ByVal lpExtension As String, _ ByVal nBufferLength As Long, ByVal lpBuffer As String,