How to create an ActiveX Control which hides the Taskbar
This tip shows how to really hide the Windows Taskbar, not to move it outside the desktop, and to avoid the API´s in the future we can make an ActiveX Control which does the work.
First create a new ActiveX Control project, add a module to it, just like you would in a normal .exe project. Put the following API declaracions into it:
Declare Function ShowWindow Lib _ "user32" (ByVal hwnd As Long, _ ByVal nCmdShow As Long) As Long Declare Function FindWindow Lib _ "user32" Alias "FindWindowA" _ (ByVal lpClassName As String, _ ByVal lpWindowName As String) _ As Long
Now we have to set some properties for the UserControl1.
Adjust the UserControl´s size to the picture.
Put the following codes to the UserControl:
'Creates the property TaskBar.Show
Public Property Let Show(ByVal VShow As Boolean)
TBwnd& = FindWindow("Shell_traywnd", "")
If VShow = True Then
'if TaskBar.Show=true it shows the TaskBar
ShowWnd& = ShowWindow(TBwnd&, 1)
Else
'if not it hides the TaskBar
ShowWnd& = ShowWindow(TBwnd&, 0)
End If
End Property
Save your project with the name TaskBar and "Make TaskBar.ocx".
Now we have to try the Control so create a new (normal) .exe app and put 2 commandbuttons on form1, with the captions "Show" and "Hide". We have to look for our own control now, click menu-project-components (or right click on the toolbox), normally all ActiveX Controls (.ocx) are located in your windowssystem folder they should appear directlly in the list if not click on the browse button and select the pathTaskBar.ocx, and confirm. The Control should appear in the toolbox with the picture you´ve selected in ToolBoxBitmap.
Place the Control on the form together with the 2 commandbuttons and add the following code to the click events of the commandbuttons:
Private Sub Command1_Click() taskbar1.Show = True End Sub Private Sub Command2_Click() taskbar1.Show = False End Sub
Execute the app. (F5) and click on the buttons.