May 19, 2001

TemporaryDirectory – Get Windows temporary directory

Private Declare Function GetTempPath Lib “kernel32” Alias “GetTempPathA” (ByVal _ nBufferLength As Long, ByVal lpBuffer As String) As LongFunction TemporaryDirectory() As String Dim buffer As String * 512, length As Long length = GetTempPath(Len(buffer), buffer) TemporaryDirectory = Left$(buffer, length)End Function

WindowDescription – Get a textual description of a window given its hWnd

Private Declare Function GetClassName Lib “user32” Alias “GetClassNameA” (ByVal _ hWnd As Long, ByVal lpClassName As String, ByVal nMaxCount As Long) As LongPrivate Declare Function GetWindowText Lib “user32” Alias “GetWindowTextA” _ (ByVal hWnd As Long, ByVal lpString As String, ByVal cch As Long) As Long’ Return a text description of

FillWindowsTree – Fill a treeview with the windows hierarchy

Private Declare Function GetWindowText Lib “user32” Alias “GetWindowTextA” _ (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As LongPrivate Declare Function GetClassName Lib “user32” Alias “GetClassNameA” (ByVal _ hwnd As Long, ByVal lpClassName As String, ByVal nMaxCount As Long) As LongPrivate Declare Function SendMessage Lib “user32”

WriteToStdOutput – Write to standard output stream

Option ExplicitPrivate Declare Function GetStdHandle Lib “kernel32” (ByVal nStdHandle As Long) _ As LongPrivate Declare Function WriteFile Lib “kernel32″ (ByVal hFile As Long, _ lpBuffer As Any, ByVal nNumberOfBytesToWrite As Long, _ lpNumberOfBytesWritten As Long, lpOverlapped As Any) As LongPrivate Const STD_OUTPUT_HANDLE = -11&’ write to standard output channel” NOTE:

ReadFromStdInput – Read from standard input stream

Private Declare Function GetStdHandle Lib “kernel32” (ByVal nStdHandle As Long) _ As LongPrivate Declare Function ReadFile Lib “kernel32” (ByVal hFile As Long, _ lpBuffer As Any, ByVal nNumberOfBytesToRead As Long, _ lpNumberOfBytesRead As Long, lpOverlapped As Any) As LongPrivate Const STD_INPUT_HANDLE = -10&’ read a number of chars from standard

GetWindowClass – The class name of a window

Private Declare Function GetClassName Lib “user32” Alias “GetClassNameA” (ByVal _ hwnd As Long, ByVal lpClassName As String, ByVal nMaxCount As Long) As Long’ Return the class name of the specified window’ Example: MsgBox GetWindowClass(Me.hWnd)Function GetWindowClass(ByVal hwnd As Long) As String Dim sClass As String sClass = Space$(256) GetClassName hwnd, sClass,