Microsoft Knowledge Base Article
This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved.
Terms
of Use |
Trademarks
Article ID: 290150 - Last Review: January 31, 2007 - Revision: 5.3
OFFXP: How to Programmatically Hide and Unhide the Windows Taskbar
This article was previously published under Q290150
For a Microsoft Office 2000 version of this article, see
202099Â
(http://kbalertz.com/Feedback.aspx?kbNumber=202099/EN-US/
)
.
For a Microsoft Office 97 version of this article, see
186119Â
(http://kbalertz.com/Feedback.aspx?kbNumber=186119/EN-US/
)
.
SUMMARY
Advanced: Requires expert coding, interoperability, and multiuser skills.
By using API calls in Visual Basic for Applications, you can
programmatically hide the Microsoft Windows 98 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.
MORE INFORMATION
Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers 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 requirements.
To create the functions and to see how they work, follow these steps:
- Press ALT+F11 to start the Visual Basic Editor.
- Type the following code in a new module:
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
- On the View menu, click Immediate Window, type the following command and then press ENTER:
?HideTaskBar()
Note that the taskbar is no longer visible.
- To restore the taskbar, type the following command in the Immediate
Window, and then press ENTER:
?UnHideTaskBar()
Note that the taskbar is now visible.
REFERENCES
For additional information getting help with Visual Basic for Applications, click the article number below
to view the article in the Microsoft Knowledge Base:
305326Â
(http://kbalertz.com/Feedback.aspx?kbNumber=305326/EN-US/
)
OFFXP: Programming Resources for Visual Basic for Applications
APPLIES TO
- Microsoft Excel 2002 Standard Edition
- Microsoft Access 2002 Standard Edition
- Microsoft FrontPage 2002 Standard Edition
- Microsoft Outlook 2002 Standard Edition
- Microsoft PowerPoint 2002 Standard Edition
- Microsoft Publisher 2002 Standard Edition
- Microsoft Word 2002 Standard Edition
Community Feedback System
Very often, it takes hours to solve a problem. Very often, you've looked high
and low, and have tried a lot of solutions. When you finally found it, chances
are, it was because someone else helped you. Here's your chance to give back.
Use our community feedback tool to let others know what worked for you and what
didn't.
Please also understand that the community feedback system is not warranted to be
correct, it's simply a system that we've built to let people try and help each
other. If something in a feedback response doesn't make sense to you, or you're
not comfortable making changes that the feedback talks about (like registry
edits), please consult a professional.
Thank you for using kbAlertz.com Feedback System.
-- Scott Cate
Be the first to leave feedback, to help others about this knowledge base
article.
(Optional) Name
(Optional)
Public URL Or Email
Comments
No
HTML -- Text Only Please