Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hide and recover taskbar

Status
Not open for further replies.

kermit01de

Technical User
Jan 20, 2002
256
DE
Using thread222-736165 I am able to hide the taskbar at the beginning of my App. Before the App ends, it recovers the taskbar.

There is another fullscreen app running (POS Software)

Now when my App ends the taskbar pops into the foreground. For security reasons that must not be the case - how to activete/recover the taskbar but bring it to the background immediately?

Any hint on that?

Thanky

Mirko

--------------------------------------
>>>>>> Bugs will appear in one part of a working program when another 'unrelated' part is modified <<<<<
 
>Any hint on that?

Sure - do it the proper way, using SHAppBarMessage ...
 
Thank you - have been travelling home yesterday, so I was not able to test it. Will test next week and feedback to you.

--------------------------------------
>>>>>> Bugs will appear in one part of a working program when another 'unrelated' part is modified <<<<<
 
Any luck looking at SHAppBarMessage?

(Naturally, I have example code if you want ;-) )
 
Some luck ...

I get the values of height and width to store them for recovering afterwards (TBH and TBW variables). But I do not have any success trying the SETPOS ...

Any help will be appreciated

--------------------------------------
>>>>>> Bugs will appear in one part of a working program when another 'unrelated' part is modified <<<<<
 
Module (I've provided far more constants than are needed for this example in case you haven't got them and were interested in exploring this API call further for ypurself):
Code:
[blue]Option Explicit

Public Declare Function SHAppBarMessage Lib "shell32.dll" (ByVal dwMessage As Long, pData As APPBARDATA) As Long
Public Declare Function FindWindow Lib "user32.dll" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long

' Appbar constants
Public Const ABE_BOTTOM = 3
Public Const ABE_LEFT = 0
Public Const ABE_RIGHT = 2
Public Const ABE_TOP = 1
' AppBar messages
Public Const ABM_ACTIVATE = &H6               '  lParam == TRUE/FALSE means activate/deactivate
Public Const ABM_GETAUTOHIDEBAR = &H7
Public Const ABM_GETSTATE = &H4
Public Const ABM_GETTASKBARPOS = &H5
Public Const ABM_NEW = &H0
Public Const ABM_QUERYPOS = &H2
Public Const ABM_REMOVE = &H1
Public Const ABM_SETAUTOHIDEBAR = &H8          '  this can fail at any time.  MUST check the result. Better to use SETSTATE
Public Const ABM_SETPOS = &H3
Public Const ABM_WINDOWPOSCHANGED = &H9
Public Const ABM_SETSTATE = &HA
' AppBar notifications
Public Const ABN_FULLSCREENAPP = &H2
Public Const ABN_POSCHANGED = &H1
Public Const ABN_STATECHANGE = &H0
Public Const ABN_WINDOWARRANGE = &H3 '  lParam == TRUE means hide
' AppBar states
Public Enum AppBarState
    ABS_NOHIDENOTOP = &H0 ' Autohide and always-on-top both off
    ABS_AUTOHIDE = &H1 ' Autohide on, always-on-top off
    ABS_ALWAYSONTOP = &H2 ' Always-on-top on, autohide off
    ABS_AUTOHIDEONTOP = &H3 'Autohide and always-on-top both on
End Enum

Public Type RECT
        Left As Long
        Top As Long
        Right As Long
        Bottom As Long
End Type

Public Type APPBARDATA
        cbSize As Long
        hwnd As Long
        uCallbackMessage As Long
        uEdge As Long
        rc As RECT
        lParam As Long '  message specific
End Type

Public Function ChangeAppBarState(Optional State As AppBarState = ABS_ALWAYSONTOP)
    Dim ThisAppBar As APPBARDATA
    
    ThisAppBar.hwnd = FindWindow("Shell_TrayWnd", "")
    ThisAppBar.cbSize = Len(ThisAppBar)
    
    ThisAppBar.lParam = State
    SHAppBarMessage ABM_SETSTATE, ThisAppBar
End Function[/blue]
Form with two command buttons:
Code:
[blue]Option Explicit
Private Sub Command1_Click()
    ChangeAppBarState ABS_AUTOHIDE
End Sub

Private Sub Command2_Click()
    ChangeAppBarState ABS_ALWAYSONTOP
End Sub[/blue]
 
Thanks, but in this case that is not what I wanted. I wanted to set the taskbar to 0 size and set it back to normal when I end my app.

No matter - the IT Managers here cut of everything from the startmenu for the users on the POS Terminal - so ... no matter when the taskbar pops up - and they try to click on anything - There is only: Log off and shutdown available.

Funny - but why do they let me think and try for some days - and finally do what I suggested first???

Thanks again strongm!

Mirko

--------------------------------------
>>>>>> Bugs will appear in one part of a working program when another 'unrelated' part is modified <<<<<
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top