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

Share your advanced PureBasic knowledge/code with the community.
RASHAD
PureBasic Expert
PureBasic Expert
Posts: 4951
Joined: Sun Apr 12, 2009 6:27 am

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

Post 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)

Egypt my love
User avatar
skywalk
Addict
Addict
Posts: 4213
Joined: Wed Dec 23, 2009 10:14 pm
Location: Boston, MA

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

Post by skywalk »

Thanks Rashad!
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5494
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

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

Post by Kwai chang caine »

Thanks RASHAD, furthermore that's works on XP SP3 8)
ImageThe happiness is a road...
Not a destination
User avatar
Tomi
Enthusiast
Enthusiast
Posts: 270
Joined: Wed Sep 03, 2008 9:29 am

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

Post by Tomi »

Thanks :D 7 x64
User avatar
freepurebasic
Enthusiast
Enthusiast
Posts: 123
Joined: Fri Sep 24, 2010 12:02 pm
Location: world wide web

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

Post 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
Jeromyal
Enthusiast
Enthusiast
Posts: 216
Joined: Wed Jul 17, 2013 8:49 am

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

Post 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.
Post Reply