Multiple Apps

Hide the Windows Taskbar

Ease of Use

Intermediate

Version tested with

2000/XP 

Submitted by:

Zack Barresse

Description:

Hides the Windows taskbar from view. You'll likely want to combine this code with some other procedure(s). 

Discussion:

Perhaps you have designed a test that you want users to take, and want to temporarily disable the use of the Windows taskbar. Or perhaps you've created some kind of game, and you need all the "real estate" available on the screen for your application. Use this code to at least temporarily hide the Windows taskbar. This procedure is a "toggle". That means that when you run it, it turns on or off, the opposite of its current status. I strongly suggest creating another macro that calls one to hide, and assigning a macro that calls one to unhide. 

Code:

instructions for use

			

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

How to use:

  1. Copy the code above.
  2. Open any file.
  3. Hit Alt+F11 to open the Visual Basic Editor (VBE).
  4. Click Insert - Module, paste code in right window.
  5. Close the VBE.
  6. Create two forms buttons using the Forms toolbar, and assign one to the macro Filename.xls.Module1.HideTaskbar; and assign the other to the macro Filename.xls.Module1.UnhideTaskbar.
 

Test the code:

  1. Click on one of the form buttons.
 

Sample File:

HideUnhide.zip 6.78KB 

Approved by mdmackillop


This entry has been viewed 114 times.

Please read our Legal Information and Privacy Policy
Copyright @2004 - 2020 VBA Express