Windows Taskbar visibility

I have a situation where the Windows taskbar gets hidden by a floating window. I know that I can change the Menu Bar Visible flag in the Inspector to leave the taskbar visible. But on occasion I need to be able to turn it back on in code. I’ve searched the LR and these forums but haven’t found a way to do it since MenuBarVisible was deprecated. (Yes, I know it still works but I’d rather not write code that depends on what may become a bug.)

Has Xojo come up with a replacement or is there a Windows Declare that I might be able to use?

Thanks, all.

Modularize it as you see fit.

Declare Function FindWindow Lib "User32.dll" Alias "FindWindowW" ( _
lpClassName As WString, _
lpWindowName As WString _
) As Integer

Declare Function SetWindowPos Lib "User32.dll" Alias "SetWindowPos" ( _
hWnd As Integer, _
hWndInsertAfter As Integer, _
X As Int32, _
Y As Int32, _
cx As Int32, _
cy As Int32, _
uFlags As UInt32 _
) As Int32

Const SWP_HIDEWINDOW = &h0080
Const SWP_SHOWWINDOW = &h0040
Const SWP_NOACTIVATE = &h0010 'so our app doesn't lose focus when we call SetWindowPos

Dim taskbar As Integer = FindWindow("Shell_traywnd", "")
Call SetWindowPos(taskbar, 0, 0, 0, 0, 0, SWP_HIDEWINDOW Or SWP_NOACTIVATE)
3 Likes

Thanks, Julian. That gives me exactly what I needed.