WEBINAR:
On-Demand
Desktop-as-a-Service Designed for Any Cloud ? Nutanix Frame
No windows underneath
Some programs have an option called "Always On Top", which allows them to stay above less important windows, that do not have such an option. If two programs do have this same option, the effect is somewhat nullified.
There is certainly room for improvement, to continually ensure top most status of your osk.
However, this can be an inferior design because your osk may be laying on top of the window that you want to send input to.
If the option is not used, then the window may lay on top of your osk instead. The user is then forced to move windows around, so that they may see the window with keyboard focus, and the keyboard at the same time.
The solution, is to move those windows from under the keyboard, and place them gently into the largest available space on the desktop. Maximized windows must also be taken into consideration, since they will end up under the keyboard, which hides their status bar area.
The following code demonstrates how to move other windows out, from underneath your form into the desktop work area. You could repeat this in a thread or timer sub procedure.
[VB0575.JPG]
Const ABS_AUTOHIDE As Int32 = 1
Const ABS_ONTOP As Int32 = 2
Const ABM_GETSTATE As Int32 = 4
Const ABM_GETTASKBARPOS As Int32 = 5
Const GWL_STYLE As Int32 = -16
Const WS_POPUP As Int32 = -2147483648
Const WS_BORDER As Int32 = 8388608
Const WS_SYSMENU As Int32 = 524288
Const WS_POPUPWINDOW As Int32 = _
(WS_POPUP Or WS_BORDER Or WS_SYSMENU)
Private Structure WINDOWNAME
Public lpText, lpClassName As String
End Structure
Public Structure RECT
Public rLeft, rTop, rRight, rBottom As Int32
End Structure
Private Structure TASKBARINFO
Public isTop, isBottom, isLeft, isRight As Boolean
Public autoHide, alwaysTop As Boolean
Public hwnd, width, height As Int32
Public top, bottom, left, right As Int32
End Structure
Private Structure APPBARDATA
Public cbSize, hwnd, uCallbackMessage, uEdge As Int32
Public rc As RECT, lParam As Int32
End Structure
Private Declare Function apiMoveWindow Lib _
"user32" Alias "MoveWindow" _
(ByVal hWnd As Int32, _
ByVal x As Int32, _
ByVal y As Int32, _
ByVal nWidth As Int32, _
ByVal nHeight As Int32, _
ByVal bRepaint As Boolean) As Boolean
Private Declare Function apiGetWindowRect Lib _
"user32" Alias "GetWindowRect" _
(ByVal hWnd As Int32, _
ByRef lpRect As RECT) As Boolean
Private Declare Function apiGetWindowText Lib _
"user32" Alias "GetWindowTextA" _
(ByVal hWnd As Int32, _
ByVal lpString As String, _
ByVal cch As Int32) As Int32
Private Declare Function apiGetWindowTextLength Lib _
"user32" Alias "GetWindowTextLengthA" _
(ByVal hWnd As Int32) As Int32
Private Declare Function apiEnumWindows Lib _
"user32" Alias "EnumWindows" _
(ByVal lpEnumFunc As EnumFuncDeleg, _
ByVal lParam As Int32) As Int32
Private Declare Function apiIsWindowVisible Lib _
"user32" Alias "IsWindowVisible" _
(ByVal hWnd As Int32) As Boolean
Private Declare Function apiIsIconic Lib _
"user32" Alias "IsIconic" _
(ByVal hWnd As Int32) As Boolean
Private Declare Function apiIsZoomed Lib _
"user32" Alias "IsZoomed" _
(ByVal hWnd As Int32) As Boolean
Private Declare Function apiGetWindowLong Lib _
"user32" Alias "GetWindowLongA" _
(ByVal hwnd As Int32, _
ByVal nIndex As Int32) As Int32
Private Declare Function apiFindWindow Lib _
"user32" Alias "FindWindowA" _
(ByVal lpClassName As String, _
ByVal lpWindowName As String) As Int32
Private Declare Function apiGetClassName Lib _
"user32" Alias "GetClassNameA" _
(ByVal hWnd As Int32, _
ByVal lpClassName As String, _
ByVal nMaxCount As Int32) As Int32
Private Declare Function apiSHAppBarMessage Lib _
"shell32" Alias "SHAppBarMessage" _
(ByVal dwMessage As Int32, _
ByRef pData As APPBARDATA) As Int32
Private Declare Function apiGetKeyState Lib _
"user32" Alias "GetKeyState" _
(ByVal vKey As Int32) As Int32
Private Delegate Function EnumFuncDeleg _
(ByVal hwnd As Int32, _
ByVal lpData As Int32) As Int32
Private wText As String
Private Sub Button1_Click _
(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click
apiEnumWindows(AddressOf NoWindows, 0)
End Sub
Private Function NoWindows _
(ByVal hwnd As Int32, ByVal lpData As Int32) As Int32
NoWindows = 1 'set return
'If window is visible and not minimized
If apiIsWindowVisible(hwnd) = True AndAlso apiIsIconic(hwnd) = False Then
wText = GetWindowText(hwnd) 'Get the title
'Found top-level window that has a title, and is not the desktop progman
If wText <> "" AndAlso wText <> "Program Manager" Then
'if the window is not this program, then make sure it's not under us
If hwnd <> Me.Handle.ToInt32 Then NoWinBeneath(Me.Handle.ToInt32, hwnd)
End If
End If
End Function
Private Function NoWinBeneath(ByVal twnd As Int32, ByVal hwnd As Int32) As Boolean
On Error Resume Next
Dim fHeight, fWidth As Int32
Dim r, r2 As New RECT
Dim d As New Size
Dim tb As New TASKBARINFO
apiGetWindowRect(hwnd, r)
apiGetWindowRect(twnd, r2)
fHeight = (r.rBottom - r.rTop)
fWidth = (r.rRight - r.rLeft)
If fWidth < 1 OrElse fHeight < 1 Then Exit Function
d = My.Computer.Screen.WorkingArea.Size
tb = GetTaskBarInfo(False)
If apiIsZoomed(hwnd) = True Then 'Maximized
If tb.isBottom = True Then
'If area above the osk has more room fit it there
If (r2.rTop - 0) > (tb.top - r2.rBottom) Then
apiMoveWindow _
(hwnd, 0, 0, d.Width, (r2.rTop - 0), True)
Else 'If below has more room
apiMoveWindow _
(hwnd, 0, r2.rBottom, d.Width, (tb.top - r2.rBottom), True)
End If
ElseIf tb.isLeft Then
'If area above the osk has more room fit it there
If (r2.rTop - 0) > (d.Height - r2.rBottom) Then
apiMoveWindow _
(hwnd, tb.right, 0, d.Width, (r2.rTop - 0), True)
Else 'If below has more room
apiMoveWindow _
(hwnd, tb.right, r2.rBottom, d.Width, (d.Height - r2.rBottom), True)
End If
ElseIf tb.isRight Then
'If area above the osk has more room fit it there
If (r2.rTop - 0) > (d.Height - r2.rBottom) Then
apiMoveWindow _
(hwnd, 0, 0, d.Width, (r2.rTop - 0), True)
Else 'If below has more room
apiMoveWindow _
(hwnd, 0, r2.rBottom, d.Width, (d.Height - r2.rBottom), True)
End If
ElseIf tb.isTop Then
'If area above the osk has more room fit it there
If (r2.rTop - tb.bottom) > (d.Height - r2.rBottom) Then
apiMoveWindow _
(hwnd, 0, tb.bottom, d.Width, (r2.rTop - tb.bottom), True)
Else 'If below has more room
apiMoveWindow _
(hwnd, 0, r2.rBottom, d.Width, (d.Height - r2.rBottom) + tb.height, True)
End If
End If
Else 'If not maximized, could be normal or a popup
Dim topWorkArea, botWorkArea As Int32
If tb.isTop = True Then
topWorkArea = (r2.rTop - tb.bottom)
botWorkArea = d.Height - (r2.rBottom - tb.height)
Else
topWorkArea = r2.rTop
botWorkArea = (d.Height - r2.rBottom)
End If
'If area above the osk has more room fit the foreground there
If topWorkArea > botWorkArea Then
'If foreground bottom below our top(MOVE IT)
If r.rBottom > r2.rTop AndAlso ((r.rLeft < r2.rLeft AndAlso r.rRight > r2.rLeft) _
OrElse (r.rLeft > r2.rLeft AndAlso r.rLeft < r2.rRight)) Then
If fHeight <= topWorkArea Then 'Will fit move it into the area
apiMoveWindow(hwnd, r.rLeft, (r2.rTop - fHeight), fWidth, fHeight, True)
Else 'If height to big for available upper realestate see if it's shrinkable
'if not a popup then it's shrinkable
If WS_POPUPWINDOW <> _
(apiGetWindowLong(hwnd, GWL_STYLE) And WS_POPUPWINDOW) Then
If tb.isTop = True Then
apiMoveWindow _
(hwnd, r.rLeft, tb.bottom, fWidth, topWorkArea, True)
Else
apiMoveWindow _
(hwnd, r.rLeft, 0, fWidth, topWorkArea, True)
End If
Else 'if is popup can't shrink those
If tb.isTop = True Then
apiMoveWindow _
(hwnd, r.rLeft, tb.bottom, fWidth, fHeight, True)
Else
apiMoveWindow _
(hwnd, r.rLeft, 0, fWidth, fHeight, True)
End If
End If
End If
End If
Else 'If below our form has more area
'If foreground top above our bottom(MOVE IT)
If r.rTop < r2.rBottom AndAlso ((r.rLeft < r2.rLeft AndAlso r.rRight > r2.rLeft) _
OrElse (r.rLeft > r2.rLeft AndAlso r.rLeft < r2.rRight)) Then
If fHeight <= botWorkArea Then 'Will fit move it into the area
apiMoveWindow(hwnd, r.rLeft, r2.rBottom, fWidth, fHeight, True)
Else 'If height to big for available realestate see if it's shrinkable
'if not a popup then it's shrinkable
If WS_POPUPWINDOW <> _
(apiGetWindowLong(hwnd, GWL_STYLE) And WS_POPUPWINDOW) Then
If tb.isTop = True Then
apiMoveWindow _
(hwnd, r.rLeft, r2.rBottom, fWidth, botWorkArea, True)
Else
apiMoveWindow _
(hwnd, r.rLeft, r2.rBottom, fWidth, botWorkArea, True)
End If
Else 'if is popup can't shrink those
If tb.isTop = True Then
apiMoveWindow _
(hwnd, r.rLeft, (d.Height - fHeight) + tb.height, fWidth, fHeight, True)
Else
apiMoveWindow _
(hwnd, r.rLeft, (d.Height - fHeight), fWidth, fHeight, True)
End If
End If
End If
End If
End If
End If
End Function
Private Function GetWindowText(ByVal hWnd As Int32) As String
On Error Resume Next
Dim tLength, rValue As Int32
tLength = apiGetWindowTextLength(hWnd) + 4
GetWindowText = ""
GetWindowText = GetWindowText.PadLeft(tLength)
rValue = apiGetWindowText(hWnd, GetWindowText, tLength)
GetWindowText = GetWindowText.Substring(0, rValue)
End Function
Private Function GetTaskBarInfo _
(ByVal getAppearance As Boolean) As TASKBARINFO
On Error Resume Next
Dim ret As Int32, d As New Size, r As New RECT
Dim hwnd As Int32 = apiFindWindow("Shell_TrayWnd", Nothing)
apiGetWindowRect(hwnd, r)
GetTaskBarInfo.hwnd = hwnd
GetTaskBarInfo.height = (r.rBottom - r.rTop)
GetTaskBarInfo.width = (r.rRight - r.rLeft)
GetTaskBarInfo.top = r.rTop
GetTaskBarInfo.bottom = r.rBottom
GetTaskBarInfo.left = r.rLeft
GetTaskBarInfo.right = r.rRight
d = My.Computer.Screen.WorkingArea.Size
If r.rTop = 0 AndAlso r.rBottom = d.Height Then 'TaskBar Position
If r.rLeft < (d.Width / 2) Then
GetTaskBarInfo.isLeft = True '''''''''''''''' left
Else
GetTaskBarInfo.isRight = True ''''''''''''''''right
End If
Else
If r.rTop < (d.Height / 2) Then
GetTaskBarInfo.isTop = True ''''''''''''''''top
Else
GetTaskBarInfo.isBottom = True ''''''''''''''''bottom
End If
End If
If getAppearance = False Then Exit Function
ret = apiSHAppBarMessage(ABM_GETSTATE, Nothing)
If ret = ABS_AUTOHIDE OrElse ret = ABS_ONTOP + ABS_AUTOHIDE Then
GetTaskBarInfo.autoHide = True
End If
If CDbl(Environment.OSVersion.VersionString.Substring(21, 3)) > 6.0 Then
If ret = 0 Then GetTaskBarInfo.alwaysTop = True
Else
If ret = ABS_ONTOP OrElse ret = ABS_ONTOP + ABS_AUTOHIDE Then
GetTaskBarInfo.alwaysTop = True
End If
End If
End Function
[VB675.JPG]
Here is that same code in a VB6 module.
Const SPI_GETWORKAREA As Long = 48
Const ABS_AUTOHIDE As Long = 1
Const ABS_ONTOP As Long = 2
Const ABM_GETSTATE As Long = 4
Const ABM_GETTASKBARPOS As Long = 5
Const WS_POPUP As Long = &H80000000
Const WS_BORDER As Long = 8388608
Const WS_SYSMENU As Long = 524288
Const WS_POPUPWINDOW As Long = (WS_POPUP Or WS_BORDER Or WS_SYSMENU)
Const GWL_STYLE As Long = -16
Private Type WINDOWNAME
lpText As String
lpClassName As String
End Type
Private Type RECT
rLeft As Long
rTop As Long
rRight As Long
rBottom As Long
End Type
Private Type TASKBARINFO
isTop As Boolean
isBottom As Boolean
isLeft As Boolean
isRight As Boolean
autoHide As Boolean
alwaysTop As Boolean
hwnd As Long
width As Long
height As Long
top As Long
bottom As Long
left As Long
right As Long
End Type
Private Type APPBARDATA
cbSize As Long
hwnd As Long
uCallbackMessage As Long
uEdge As Long
rc As RECT
lParam As Long
End Type
Private Declare Function apiMoveWindow Lib "user32" Alias "MoveWindow" _
(ByVal hwnd As Long, _
ByVal x As Long, _
ByVal y As Long, _
ByVal nWidth As Long, _
ByVal nHeight As Long, _
ByVal bRepaint As Boolean) As Boolean
Private Declare Function apiGetWindowRect Lib "user32" Alias "GetWindowRect" _
(ByVal hwnd As Long, _
ByRef lpRect As RECT) As Boolean
Private Declare Function apiGetWindowText Lib "user32" Alias "GetWindowTextA" _
(ByVal hwnd As Long, _
ByVal lpString As String, _
ByVal cch As Long) As Long
Private Declare Function apiGetWindowTextLength Lib "user32" Alias "GetWindowTextLengthA" _
(ByVal hwnd As Long) As Long
Private Declare Function apiIsZoomed Lib "user32" Alias "IsZoomed" _
(ByVal hwnd As Long) As Boolean
Private Declare Function apiGetWindowLong Lib "user32" Alias "GetWindowLongA" _
(ByVal hwnd As Long, _
ByVal nIndex As Long) As Long
Private Declare Function apiFindWindow Lib "user32" Alias "FindWindowA" _
(ByVal lpClassName As String, _
ByVal lpWindowName As String) As Long
Private Declare Function apiGetClassName Lib "user32" Alias "GetClassNameA" _
(ByVal hwnd As Long, _
ByVal lpClassName As String, _
ByVal nMaxCount As Long) As Long
Private Declare Function apiSHAppBarMessage Lib "shell32" Alias "SHAppBarMessage" _
(ByVal dwMessage As Long, _
ByRef pData As APPBARDATA) As Long
Private Declare Function apiGetKeyState Lib "user32" Alias "GetKeyState" _
(ByVal vKey As Long) As Long
Private wText As String
Private Declare Function apiSystemParametersInfo Lib "user32" Alias "SystemParametersInfoA" _
(ByVal uAction As Long, _
ByVal uParam As Long, _
ByRef lpvParam As RECT, _
ByVal fuWinIni As Long) As Boolean
Private Declare Function apiIsWindowVisible Lib "user32" Alias "IsWindowVisible" _
(ByVal hwnd As Long) As Long
Private Declare Function apiIsIconic Lib "user32" Alias "IsIconic" _
(ByVal hwnd As Long) As Boolean
Public Declare Function apiEnumWindows Lib "user32" Alias "EnumWindows" _
(ByVal lpEnumFunc As Long, _
ByVal lParam As Long) As Boolean
Public Function NoWindows(ByVal hwnd As Long, ByVal lpData As Long) As Boolean
NoWindows = True 'set return
If apiIsWindowVisible(hwnd) = 0 Then Exit Function 'If window invisible
If apiIsIconic(hwnd) = True Then Exit Function 'if minimized
wText = GetWindowText(hwnd) 'Get the title
'If top-level window has no title, 'or is the desktop progman
If wText = "" Or wText = "Program Manager" Then Exit Function
If hwnd = Form1.hwnd Then Exit Function 'if the window is this program
Call NoWinBeneath(Form1.hwnd, hwnd) 'Move window from underneath
End Function
Private Function NoWinBeneath(ByVal twnd As Long, ByVal hwnd As Long) As Boolean
On Error Resume Next
Dim tb As TASKBARINFO
Dim r As RECT
Dim r2 As RECT
Dim dr As RECT
Dim fHeight As Long
Dim fWidth As Long
Dim dWidth As Long
Dim dHeight As Long
Dim mHeight As Long
Call apiGetWindowRect(hwnd, r)
Call apiGetWindowRect(twnd, r2)
Call apiSystemParametersInfo(SPI_GETWORKAREA, 0, dr, 0)
fHeight = (r.rBottom - r.rTop)
fWidth = (r.rRight - r.rLeft)
dWidth = dr.rRight - dr.rLeft
dHeight = dr.rBottom - dr.rTop
mHeight = r2.rBottom - r2.rTop
tb = GetTaskBarInfo(False)
If fHeight < 1 Or fWidth < 1 Then Exit Function
If apiIsZoomed(hwnd) = True Then 'Maximized
If tb.isBottom = True Then
'If area above the osk has more room fit it there
If (r2.rTop - 0) > (tb.top - r2.rBottom) Then
Call apiMoveWindow _
(hwnd, 0, 0, dWidth, (r2.rTop - 0), True)
Else 'If below has more room
Call apiMoveWindow _
(hwnd, 0, r2.rBottom, dWidth, (tb.top - r2.rBottom), True)
End If
ElseIf tb.isLeft Then
'If area above the osk has more room fit it there
If (r2.rTop - 0) > (dHeight - r2.rBottom) Then
Call apiMoveWindow _
(hwnd, tb.right, 0, dWidth, (r2.rTop - 0), True)
Else 'If below has more room
Call apiMoveWindow _
(hwnd, tb.right, r2.rBottom, dWidth, (dHeight - r2.rBottom), True)
End If
ElseIf tb.isRight Then
'If area above the osk has more room fit it there
If (r2.rTop - 0) > (dHeight - r2.rBottom) Then
Call apiMoveWindow _
(hwnd, 0, 0, dWidth, (r2.rTop - 0), True)
Else 'If below has more room
Call apiMoveWindow _
(hwnd, 0, r2.rBottom, dWidth, (dHeight - r2.rBottom), True)
End If
ElseIf tb.isTop Then
'If area above the osk has more room fit it there
If (r2.rTop - tb.bottom) > (dHeight - r2.rBottom) Then
Call apiMoveWindow _
(hwnd, 0, tb.bottom, dWidth, (r2.rTop - tb.bottom), True)
Else 'If below has more room
Call apiMoveWindow _
(hwnd, 0, r2.rBottom, dWidth, (dHeight - r2.rBottom) + tb.height, True)
End If
End If
Else 'If not maximized, could be normal or a popup
Dim topWorkArea, botWorkArea As Long
If tb.isTop = True Then
topWorkArea = (r2.rTop - tb.bottom)
botWorkArea = dHeight - ((r2.rTop + mHeight) - tb.height)
Else
topWorkArea = r2.rTop
botWorkArea = (dHeight - r2.rBottom)
End If
'If area above the osk has more room fit the foreground there
If topWorkArea > botWorkArea Then
'If foreground bottom below our top(MOVE IT)
If r.rBottom > r2.rTop And _
((r.rLeft < r2.rLeft And r.rRight > r2.rLeft) Or _
(r.rLeft > r2.rLeft And r.rLeft < r2.rRight)) Then
If fHeight <= topWorkArea Then 'Will fit move it into the area
Call apiMoveWindow _
(hwnd, r.rLeft, (r2.rTop - fHeight), fWidth, fHeight, True)
Else 'If height to big for available upper area
'if not a popup then it's shrinkable
If WS_POPUPWINDOW <> _
(apiGetWindowLong(hwnd, GWL_STYLE) And WS_POPUPWINDOW) Then
If tb.isTop = True Then
Call apiMoveWindow _
(hwnd, r.rLeft, tb.bottom, fWidth, topWorkArea, True)
Else
Call apiMoveWindow _
(hwnd, r.rLeft, 0, fWidth, topWorkArea, True)
End If
Else 'if is popup can't shrink those
If tb.isTop = True Then
Call apiMoveWindow _
(hwnd, r.rLeft, tb.bottom, fWidth, fHeight, True)
Else
Call apiMoveWindow _
(hwnd, r.rLeft, 0, fWidth, fHeight, True)
End If
End If
End If
End If
Else 'If below our form has more area
'If foreground top above our bottom(MOVE IT)
If r.rTop < r2.rBottom And ((r.rLeft < r2.rLeft And r.rRight > r2.rLeft) _
Or (r.rLeft > r2.rLeft And r.rLeft < r2.rRight)) Then
If fHeight <= botWorkArea Then 'Will fit move it into the area
Call apiMoveWindow _
(hwnd, r.rLeft, r2.rBottom, fWidth, fHeight, True)
Else 'If height to big for available realestate see if it's shrinkable
'if not a popup then it's shrinkable
If WS_POPUPWINDOW <> _
(apiGetWindowLong(hwnd, GWL_STYLE) And WS_POPUPWINDOW) Then
If tb.isTop = True Then
Call apiMoveWindow _
(hwnd, r.rLeft, r2.rBottom, fWidth, botWorkArea, True)
Else
Call apiMoveWindow _
(hwnd, r.rLeft, r2.rBottom, fWidth, botWorkArea, True)
End If
Else 'if is popup can't shrink those
If tb.isTop = True Then
Call apiMoveWindow _
(hwnd, r.rLeft, (dHeight - fHeight) + tb.height, fWidth, fHeight, True)
Else
Call apiMoveWindow _
(hwnd, r.rLeft, (dHeight - fHeight), fWidth, fHeight, True)
End If
End If
End If
End If
End If
End If
End Function
Private Function GetWindowText(ByVal hwnd As Long) As String
On Error Resume Next
Dim tLength As Long
Dim rValue As Long
GetWindowText = ""
tLength = apiGetWindowTextLength(hwnd) + 4 'Get length
GetWindowText = Strings.Space(tLength) 'Pad with buffer
rValue = apiGetWindowText(hwnd, GetWindowText, tLength) 'Get text
GetWindowText = left(GetWindowText, rValue) 'Strip buffer
End Function
Private Function GetTaskBarInfo _
(ByVal getAppearance As Boolean) As TASKBARINFO
On Error Resume Next
Dim ret As Long
Dim r As RECT
Dim hwnd As Long
Dim dr As RECT
Dim dWidth As Long
Dim dHeight As Long
Call apiSystemParametersInfo(SPI_GETWORKAREA, 0, dr, 0)
dWidth = dr.rRight - dr.rLeft
dHeight = dr.rBottom - dr.rTop
hwnd = apiFindWindow("Shell_TrayWnd", vbNullString)
Call apiGetWindowRect(hwnd, r)
GetTaskBarInfo.hwnd = hwnd
GetTaskBarInfo.height = (r.rBottom - r.rTop)
GetTaskBarInfo.width = (r.rRight - r.rLeft)
GetTaskBarInfo.top = r.rTop
GetTaskBarInfo.bottom = r.rBottom
GetTaskBarInfo.left = r.rLeft
GetTaskBarInfo.right = r.rRight
If r.rTop = 0 And r.rBottom = dHeight Then 'TaskBar Position
If r.rLeft < (dWidth / 2) Then
GetTaskBarInfo.isLeft = True '''''''''''''''' left
Else
GetTaskBarInfo.isRight = True ''''''''''''''''right
End If
Else
If r.rTop < (dHeight / 2) Then
GetTaskBarInfo.isTop = True ''''''''''''''''top
Else
GetTaskBarInfo.isBottom = True ''''''''''''''''bottom
End If
End If
If getAppearance = False Then Exit Function
Dim abd As APPBARDATA
ret = apiSHAppBarMessage(ABM_GETSTATE, abd)
If ret = ABS_AUTOHIDE Or ret = ABS_ONTOP + ABS_AUTOHIDE Then
GetTaskBarInfo.autoHide = True
End If
If CDbl(Environment.OSVersion.VersionString.Substring(21, 3)) > 6# Then
If ret = 0 Then GetTaskBarInfo.alwaysTop = True
Else
If ret = ABS_ONTOP Or ret = ABS_ONTOP + ABS_AUTOHIDE Then
GetTaskBarInfo.alwaysTop = True
End If
End If
End Function
The call to that module would look something like this.
Private Sub Command1_Click()
Call apiEnumWindows(AddressOf NoWindows, 0)
End Sub