CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: Hide Task Bar

  1. #1
    Join Date
    Jun 2001
    Location
    Haryana,India
    Posts
    8

    Hide Task Bar

    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)






  2. #2
    Join Date
    May 2000
    Location
    New York, NY, USA
    Posts
    2,878

    Re: Hide Task Bar

    '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
    [email protected]
    Iouri Boutchkine
    [email protected]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured