March 10, 2001

Object Creation Under Windows NT4 and Windows 2000

Before I continue, I’d like to state up front thatnothing in this article should be construed as casting Windows 2000 / COM+ in anegative light. On the contrary, I’ve seen pretty much across the boardperformance increases for reasonably constructed transactions.The particular application I’m about to present has pretty drasticallydeviated from

GetAppFilename – Return the application’s file name and path

Private Declare Function GetModuleFileName Lib “kernel32” Alias _ “GetModuleFileNameA” (ByVal hModule As Long, ByVal lpFileName As String, _ ByVal nSize As Long) As LongPrivate Declare Function GetModuleHandle Lib “kernel32” Alias _ “GetModuleHandleA” (ByVal lpModuleName As String) As Long’ return the application’s filename” it is similar to App.Path+App.ExeName, but it also’

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′ Change the system’s desktop wallpaper to a given bitmap file’ If you omit the argument the desktop wallpaper is cleared”

SystemErrorDescription – Convert an API error code to a string

Private Declare Function FormatMessage Lib “kernel32” Alias “FormatMessageA” _ (ByVal dwFlags As Long, lpSource As Any, ByVal dwMessageId As Long, _ ByVal dwLanguageId As Long, ByVal lpBuffer As String, ByVal nSize As Long, _ Arguments As Long) As LongPrivate Const FORMAT_MESSAGE_FROM_SYSTEM = &H1000′ Convert an API error number to a

MakeDirPath – Create a path, including intermediate directories

‘ Create a nested directory” This is similar to the MkDir command, but it creates any’ intermediate directory if necessarySub MakeDirPath(dirname As String) Dim i As Long, path As String Do i = InStr(i + 1, dirname & “”, “”) path = Left$(dirname, i – 1) ‘ don’t try to

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, _ ByVal lpFilePart As String) As Long’ Search a file on the system’ returns the complete file path+name, or “”