AllAPI Network - The KPD-Team

 
Allapi Network
 API-Guide
 ApiViewer

 API List

 
API Resources
 Tips & Tricks
 VB Tutorials
 Error Lookup
 
Misc Stuff
 VB examples
 VB Tools
 VB Links
 Top Downloads
 
This Site
 Search Engine
 Contact Form
 

Donate to AllAPI.net

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 in a normal .exe app.
and 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.

  • Name="TaskBar"

  • BorderStyle=1-Fixed Single

  • CanGetFocus=False

  • EditAtDesignTime=False

  • InvisibleAtRuntime=True

  • Picture= Choose one

  • ToolBoxBitmap=Choose one

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 windows\system folder they should appear directlly in the list if not click on the browse button and select the path\TaskBar.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.

 

 


Copyright © 1998-2007, The Mentalis.org Team - Privacy statement
Did you find a bug on this page? Tell us!
This site is located at http://allapi.mentalis.org/