Solved

How to hide Win95/NT task bar from VB?

Posted on 1998-12-01
3
168 Views
Last Modified: 2010-05-03
Task bar is in the way.  Is there a way in VB5 to tell it to hide the taskbar?  Even turning Autohide on/off should work as we could then wait a second and it would autohide itself.  My print technique uses the screen for rendering and the task bar is landing in my printouts like a thumb over the 35mm lens.  UGH!
0
Comment
Question by:rayford
3 Comments
 
LVL 8

Accepted Solution

by:
MikeP090797 earned 50 total points
Comment Utility
Dim hFw as long
hfW = FindWindow("Shell_TrayWnd", vbNULLString)
ShowWindow hFw, SW_HIDE

0
 
LVL 14

Expert Comment

by:waty
Comment Utility
Here is another quite same way :

Private Const SWP_HIDEWINDOW = &H80
Private Const SWP_SHOWWINDOW = &H40

Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long

Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cY As Long, ByVal wFlags As Long) As Long

Public Sub HideTaskBar()
   ' #VBIDEUtils#************************************************************
   ' * Programmer Name  : Waty Thierry
   ' * Web Site         : www.geocities.com/ResearchTriangle/6311/
   ' * E-Mail           : waty.thierry@usa.net
   ' * Date             : 2/12/98
   ' * Time             : 11:44
   ' * Module Name      : TaskBar_Module
   ' * Module Filename  : taskbar.bas
   ' * Procedure Name   : HideTaskBar
   ' * Parameters       :
   ' **********************************************************************
   ' * Comments         : Hide the taskbar

   ' *
   ' *
   ' **********************************************************************

   Dim nTaskBarhWnd        As Long

   nTaskBarhWnd = FindWindow("Shell_traywnd", "")
   If nTaskBarhWnd <> 0 Then Call SetWindowPos(nTaskBarhWnd, 0, 0, 0, 0, 0, SWP_HIDEWINDOW)
   
End Sub

0
 
LVL 1

Author Comment

by:rayford
Comment Utility
The first example worked great but I had to load the ShowWindow call from the windows API which looks like:

Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long

I tried adding Option explicit and so on but the second example still dies often all over the place with not liking the AS LONG on the DIM statement and also kicking out the Private Const lines as invalid also at least in my VB5.  Hey certainly there are no wrong guesses just better ones and other ones and all comments are genuinely appreciated!!

While we are telling people how to make the thing they like disappear I guess we had better also tell them to do this to turn it back on:

SHOWWINDOW hFw, 1
to turn the thing back ON too  :)   Thanks a bunch gang!

-Rayford
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now