How to hide a Window from the taskbar (VB3/VB4)?



    Use this code in VB3. In VB4, check out the App.TaskVisible property.

    Global Const GW_OWNER = 4
    Global Const SW_HIDE = 0
    
    Declare Function GetWindow Lib "User" (ByVal hWnd As Integer, ByVal wCmd As Integer) As Integer
    Declare Function ShowWindow Lib "User" (ByVal hWnd As Integer, ByVal nCmdShow As Integer) As
    Integer
    
    Sub SetFormInvisible (frm As Form)
    
      Dim ownerhWnd As Integer
      Dim dummy As Integer
    
      ' Make sure the form is invisible:
      frm.Visible = False
      ' Grab the background or owner window:
      ownerhWnd = GetWindow(frm.hWnd, GW_OWNER)
      ' Hide from task list:
      dummy = ShowWindow(ownerhWnd, SW_HIDE)
    End Sub
    

Mail to Daniel Wiman <daniel@wimania.com>
Online since June 1996, updated 971025
<- The VB home
<- Daniels homepage