Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi,
I'm writing a small application; however I want to hide the taskbar.(Windows'taskbar)
The bar at the bottom of the screen with all the icons.
I want it dissapears when my application is running.
How can I do that in VB6?Baba

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
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Const SWP_HIDEWINDOW = &H80
Const SWP_SHOWWINDOW = &H40Dim TaskBarHwnd As Long
Private Sub Command1_Click()
If Command1.Caption = "Hide" Then
Call SetWindowPos(TaskBarHwnd, 0&, 0&, 0&, 0&, 0&, SWP_HIDEWINDOW)
Command1.Caption = "Show"
Else
Call SetWindowPos(TaskBarHwnd, 0&, 0&, 0&, 0&, 0&, SWP_SHOWWINDOW)
Command1.Caption = "Hide"
End If
End Sub'''''''''''''''''''''''''''''''''''''
Hope this is what you wanted

James,
I tested your code by quickly put a command button on a form.
unfortunately the code doesn't work, only the button caption changed from "Show" to "Hide" each time I clicked on it.
There is a bug in it, unfortunately the code is too advance for me. I can't find out what is wrong.
I greatly appreciate you response. I will play with it see if I can find the bug.Happy new year!

Sorry, i left out the api call that gets the handle of the taskbar, at the moment it is hiding nothing because the handle it is using is set to 0. The following is the code above with a form load procedure added at the bottom. During the form load it gets the handle of the taskbar, and the "show" and "hide" procedures then have something to Show and Hide:)
Sorry about that!
---------------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
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Const SWP_HIDEWINDOW = &H80
Const SWP_SHOWWINDOW = &H40
Dim TaskBarHwnd As LongPrivate Sub Command1_Click()
If Command1.Caption = "Hide" Then
Call SetWindowPos(TaskBarHwnd, 0&, 0&, 0&, 0&, 0&, SWP_HIDEWINDOW)
Command1.Caption = "Show"
Else
Call SetWindowPos(TaskBarHwnd, 0&, 0&, 0&, 0&, 0&, SWP_SHOWWINDOW)
Command1.Caption = "Hide"
End If
End SubPrivate Sub Form_Load()
TaskBarHwnd = FindWindow("Shell_traywnd", "")
End Sub

James,
You are great!
I retested the code and it works find. I would never find the problem on my own, or it would take me a while. I would have to learn to understand the Windows API first.Thank you very much! You are my savior!

![]() |
Games program
|
Can't compile java
|

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |