Solved

How to hide Win95/NT task bar from VB?

Posted on 1998-12-01
3
171 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
ID: 1447639
Dim hFw as long
hfW = FindWindow("Shell_TrayWnd", vbNULLString)
ShowWindow hFw, SW_HIDE

0
 
LVL 14

Expert Comment

by:waty
ID: 1447640
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
ID: 1447641
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

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

828 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