Solved

How to hide Win95/NT task bar from VB?

Posted on 1998-12-01
3
173 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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 …
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

695 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