Option Compare Database Option Explicit'This prevents screen redraw. It's especially handy 'when using OLE automation. Declare Function LockWindowUpdate Lib "user32" _ (ByVal hwndLock As Long) As Long 'This is a custom Declare statement that uses the FindWindow API call 'to find a window of the specified class. Pass a long NULL pointer 'for the window name. Declare Function FindWindowByClass Lib "user32" Alias "FindWindowA" _ (ByVal lpClassName As String, ByVal lpWindowName As Long) As Long 'API Function that Points to a RECT structure that receives the screen 'co-ordinates of the upper-left and lower-right corners of a window. Private Declare Function GetWindowRect Lib "user32" _ (ByVal hwnd As Long, lpRect As RECT) As Long Private Type RECT Left As Long Top As Long Right As Long Bottom As Long
End Type 'API Function to get Screen Resolution Declare Function GetSystemMetrics Lib "user32" _ (ByVal nIndex As Integer) As Integer Public Function fnGetApplicationWindowHeight() As Long Dim hwnd As Long Dim lngRetVal As Long Dim hwndPrevious As Long 'Get the handle to this Access window. hwnd = FindWindowByClass("OMain", 0&) Dim Rec As RECT 'API uses pixels ' Get Left, Right, Top and Bottom of Access Application Window GetWindowRect hwnd, Rec fnGetApplicationWindowHeight = Rec.Bottom - Rec.Top End Function Public Function IsVGA() As Boolean Dim xRes As Integer Dim yRes As Integer IsVGA= False xRes = GetSystemMetrics(0) yRes = GetSystemMetrics(1) If xRes < 800 And yRes < 600 Then ' is vga IsVGA= True Else IsVGA= False End If End Function Public Function fnEcho(intFlag As Integer) Dim hwnd As Long Dim lngRetVal As Long Dim hwndPrevious As Long Select Case intFlag 'Echo OFF Case 0 'Get the handle to this Access window hwnd = FindWindowByClass("OMain", 0&) 'Prevent updates to this window lngRetVal = LockWindowUpdate(hwnd) 'Echo ON Case 1 lngRetVal = LockWindowUpdate(0&) End Select End Function |