Page 1 of 1

Enable / Disable Auto - Hide the TaskBar for Win 7 [Windows]

Posted: Fri Aug 26, 2011 8:16 pm
by RASHAD
Hi

Code: Select all

#ABM_SETSTATE = $A

;***********************  Enable Auto - Hide the TaskBar ******************

TaskBar = FindWindow_("Shell_TrayWnd",0)
tbdata.AppBarData
tbdata\cbSize = SizeOf(tbdata)
tbdata\hwnd = TaskBar
tbdata\lParam = 1

SHAppBarMessage_(#ABM_SETSTATE,@tbdata)

;***********************  Disable Auto - Hide the TaskBar ******************


; TaskBar = FindWindow_("Shell_TrayWnd",0)
; tbdata.AppBarData
; tbdata\cbSize = SizeOf(tbdata)
; tbdata\hwnd = TaskBar
; tbdata\lParam = 0
; 
; SHAppBarMessage_(#ABM_SETSTATE,@tbdata)


Re: Enable / Disable Auto - Hide the TaskBar for Win 7 [Wind

Posted: Fri Aug 26, 2011 10:02 pm
by skywalk
Thanks Rashad!

Re: Enable / Disable Auto - Hide the TaskBar for Win 7 [Wind

Posted: Sun Aug 28, 2011 5:53 pm
by Kwai chang caine
Thanks RASHAD, furthermore that's works on XP SP3 8)

Re: Enable / Disable Auto - Hide the TaskBar for Win 7 [Wind

Posted: Mon Aug 29, 2011 3:29 pm
by Tomi
Thanks :D 7 x64

Re: Enable / Disable Auto - Hide the TaskBar for Win 7 [Wind

Posted: Mon Aug 29, 2011 5:39 pm
by freepurebasic
nice!

Code: Select all

Procedure.l Not2(x):If x=0:ProcedureReturn 1:Else:ProcedureReturn 0:EndIf:EndProcedure
#ABM_SETSTATE = $A
sw=0
OpenWindow (0, 0, 0, 300, 50, "press F2 !!!", #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget | #PB_Window_SizeGadget | #PB_Window_ScreenCentered) And CreateGadgetList(WindowID(0))

AddKeyboardShortcut(0, #PB_Shortcut_F2, 15)
StringGadget(0, 8,  10, 280, 30, "press F2 !!! use Esc to exit!")
unic=0
Repeat
    Event = WindowEvent()

    If Event = #PB_Event_CloseWindow  ; If the user has pressed on the close button
      Quit = 1
    EndIf
     If (GetAsyncKeyState_(#VK_F2)<>0)And(unic=0)
     Repeat:Delay(5):Until GetAsyncKeyState_(#VK_F2)=0;key up !!!!
      unic=1
       sw=Not2(sw)
;     Debug sw
If sw=1
;show
TaskBar = FindWindow_("Shell_TrayWnd",0)
tbdata.AppBarData
tbdata\cbSize = SizeOf(tbdata)
tbdata\hwnd = TaskBar
tbdata\lParam = 1
Else
;hide
TaskBar = FindWindow_("Shell_TrayWnd",0)
 tbdata.AppBarData
 tbdata\cbSize = SizeOf(tbdata)
 tbdata\hwnd = TaskBar
 tbdata\lParam = 0
EndIf
SHAppBarMessage_(#ABM_SETSTATE,@tbdata)

       Delay(35)
      unic=0
     ;MessageRequester("","ad")
     EndIf   
If (GetAsyncKeyState_(#VK_ESCAPE)<>0)And(unic=0)
  End
EndIf
    Delay(1)

Until Quit = 1
End

Re: Enable / Disable Auto - Hide the TaskBar for Win 7 [Windows]

Posted: Tue Aug 02, 2022 6:31 pm
by Jeromyal
Here is my flavor/flavour

Code: Select all

  Procedure AutoHideTaskbar(State = -1)
    Static pstate
    If state = -1
      pstate = Bool(Not pstate)
    Else
      pstate = state
    EndIf
  If pstate = 0 Or pstate = 1
    Protected TaskBar = FindWindow_("Shell_TrayWnd", 0)
    Protected tbdata.AppBarData
    tbdata\cbSize = SizeOf(tbdata)
    tbdata\hwnd   = TaskBar
    tbdata\lParam = pState
    SHAppBarMessage_($A, @tbdata)
  EndIf
EndProcedure
AutoHideTaskbar() <-- empty toggles state and #true or #false sets it.