All versions of Access allow the developer to
programmatically hide the
Database Container window. However, it's not possible to
detect whether the window is visible or not. You can
use this function which will return True if the window is
currently visible inside the MDI Client window of the
application.
Private Declare Function FindWindowEx _
Lib "user32" Alias "FindWindowExA" _
(ByVal hwndParent As Long, _
ByVal hwndChildAfter As Long, _
ByVal lpszClass As String, _
ByVal lpszWindow As String) _
As Long
Private Declare Function GetWindowLong _
Lib "user32" Alias "GetWindowLongA" _
(ByVal hWnd As Long, _
ByVal nIndex As Long) _
As Long
Private Const GWL_STYLE = (-16)
Private Const WS_VISIBLE = &H10000000
Public Function fIsDBCVisible() As Boolean
Dim lngStyle As Long
Dim hWnd As Long
Const WC_MDICLIENT = "MDIClient"
Const WC_DBC = "Odb"
hWnd = FindWindowEx(hWndAccessApp, 0, _
WC_MDICLIENT, vbNullString)
hWnd = FindWindowEx(hWnd, 0, WC_DBC, vbNullString)
If (hWnd) Then
lngStyle = GetWindowLong(hWnd, GWL_STYLE)
fIsDBCVisible = ((lngStyle And WS_VISIBLE) = WS_VISIBLE)
End If
End Function
|