Taskbar Disappears (Solved)

My app was randomly killing the taskbar which would disappear on app exit and not reappear until you restarted Windows. Sometimes it would flash the taskbar off and on instead.

The culprit? A single window with Menu Bar Visible option set to on. You can only see this option under the gear symbol of the inspector when selecting the window. It wasn’t even necessary to instantiate the window apparently.

If you’re still searching for the problem, the following line of code will also kill the taskbar

dim w as new window

When it should be

dim w as new myWindowName

This is a FYI in case it hits someone else

Xojo 2021 r2.1 Windows 10 Pro (20H2)

1 Like

I ran into this a while back and, fortunately, got a bit of help from various folks here and elsewhere. So, here’s a routine I put in my toolkit for controlling the taskbar. It’s for Windows only as that’s all I program in at this time.

Public Sub TaskBarVisible(Visible As Boolean)
  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", "")
  If Visible = True Then
    Call SetWindowPos (taskbar, 0, 0, 0, 0, 0, SWP_SHOWWINDOW Or SWP_NOACTIVATE)
  Else
    Call SetWindowPos (taskbar, 0, 0, 0, 0, 0, SWP_HIDEWINDOW Or SWP_NOACTIVATE)
  End If
End Sub
2 Likes

What does your routine do?

And FYI, the culprit single window with Menubar visible set to false was an implicit instance which is why it killed the taskbar even if it wasn’t shown.

See here for more info.

I’ve often wondered why MenuBarVisible hid the taskbar on windows.

Thanks!

In the before-fore times it was used to take over for fullscreen apps such as kiosk mode or a game.

Tried this with Window1.Maximize to display full screen. Works perfectly - great share!