OFF97: How to Programmatically Hide and Unhide the Windows TaskbarID: Q186119
|
By using API calls in Visual Basic for Applications, you can programmatically hide the Microsoft Windows 95 or later, or Microsoft Windows NT 4.0 taskbar. This article shows you how to create the two functions that you need to hide and unhide the taskbar.
Microsoft provides programming examples for illustration only, without warranty
either expressed or implied, including, but not limited to, the implied warranties of
merchantability and/or fitness for a particular purpose. This article assumes that you
are familiar with the programming language being demonstrated and the tools used to
create and debug procedures. Microsoft support professionals can help explain the functionality
of a particular procedure, but they will not modify these examples to provide added
functionality or construct procedures to meet your specific needs. If you have limited
programming experience, you may want to contact a Microsoft Certified Solution Provider
or the Microsoft fee-based consulting line at (800) 936-5200. For more information about
Microsoft Certified Solution Providers, please see the following page on the World Wide Web:
http://www.microsoft.com/mcsp/For more information about the support options available from Microsoft, please see the following page on the World Wide Web:
http://www.microsoft.com/support/supportnet/overview/overview.aspTo create the functions and to see how they work, follow these steps:
Option Compare Database ' In Microsoft Access only.
Option Explicit
Dim handleW1 As Long
Private Declare Function FindWindowA Lib "user32" _
(ByVal lpClassName As String, _
ByVal lpWindowName As String) As Long
Private Declare Function SetWindowPos Lib "user32" _
(ByVal handleW1 As Long, _
ByVal handleW1InsertWhere As Long, ByVal w As Long, _
ByVal x As Long, ByVal y As Long, ByVal z As Long, _
ByVal wFlags As Long) As Long
Const TOGGLE_HIDEWINDOW = &H80
Const TOGGLE_UNHIDEWINDOW = &H40
Function HideTaskbar()
handleW1 = FindWindowA("Shell_traywnd", "")
Call SetWindowPos(handleW1, 0, 0, 0, _
0, 0, TOGGLE_HIDEWINDOW)
End Function
Function UnhideTaskbar()
Call SetWindowPos(handleW1, 0, 0, 0, _
0, 0, TOGGLE_UNHIDEWINDOW)
End Function
?HideTaskBar()In Microsoft Access, type the command above in the Debug Window, and then press ENTER.
?UnHideTaskBar()In Microsoft Access, type the command above in the Debug Window, and then press ENTER.
For more information about getting help with Visual Basic for Applications, please see the following article in the Microsoft Knowledge Base:
Q163435 VBA: Programming Resources for Visual Basic for Applications
Additional query words: inf vba
Keywords : kbdta AccCon KbVBA
Version : WINDOWS:97
Platform : WINDOWS
Issue type : kbhowto
Last Reviewed: July 30, 1999