Link to home
Start Free TrialLog in
Avatar of rayford
rayford

asked on

How to hide Win95/NT task bar from VB?

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!
ASKER CERTIFIED SOLUTION
Avatar of MikeP090797
MikeP090797

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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

Avatar of rayford
rayford

ASKER

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