Click to See Complete Forum and Search --> : Hide Task Bar


Adlakha
July 18th, 2001, 03:52 AM
Hi,
How to hide the task bar the code I have.
But this still this occupies the space of the taskbar though the task bar is hidden.
How to improve the code given below.
Or suggest some other method.

Thanks in Advance.

Deepak Adlakha


' to Hide and Show Task Bar Following two APIs are used.
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
Declare Function FindWindow Lib "user32" Alias "FindWindowA" (byval lpClassName as string, byval lpWindowName as string) as Long
public Const SWP_HIDEWINDOW = &H80
public Const SWP_SHOWWINDOW = &H40
' to Hide and Show Task Bar Above two APIs and variables are used.
1.
Dim Thwnd as Long
Thwnd = FindWindow("Shell_traywnd", "")
Call SetWindowPos(Thwnd, 0, 0, 0, 0, 0, SWP_SHOWWINDOW)

2.
Dim Thwnd as Long
Thwnd = FindWindow("Shell_traywnd", "")
Call SetWindowPos(Thwnd, 1, 1, 1, 1, 1, SWP_HIDEWINDOW)

Iouri
July 18th, 2001, 07:01 AM
'try this. It works for me

'
' Declarations
'
Public Const SWP_HIDEWINDOW = &H80
Public Const SWP_SHOWWINDOW = &H40

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

Public 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 DisplayTaskBar(ByVal bVal As Boolean)
Dim lTaskBarHWND As Long
Dim lRet As Long
Dim lFlags As Long

On Error GoTo vbErrorHandler

lFlags = IIf(bVal, SWP_SHOWWINDOW, SWP_HIDEWINDOW)


lTaskBarHWND = FindWindow("Shell_traywnd", "")

lRet = SetWindowPos(lTaskBarHWND, 0, 0, 0, 0, 0, lFlags)

If lRet < 0 Then
'
' Handle error from api
'
End If

Exit Sub

vbErrorHandler:
'
' Handle Errors here
'
End Sub


To hide :
DisplayTaskBar False

To Show ;
DisplayTaskBar True


Iouri Boutchkine
iouri@hotsheet.com