show or hide taskbar

Share your advanced PureBasic knowledge/code with the community.
vincenz2004
New User
New User
Posts: 5
Joined: Mon Apr 10, 2006 9:23 am
Contact:

show or hide taskbar

Post by vincenz2004 »

Code updated for 5.20+

This really helped me, so I hope it helps someone else. It is the code to toggle the status of the windows (XP) taskbar (SHOW or HIDE):

Code: Select all

Procedure showtaskbar(tbstate.s)
  handleW1 = FindWindow_("Shell_traywnd", "")
  If(tbstate="S")
    SetWindowPos_(handleW1, 0, 0, 0, 0, 0, #SWP_SHOWWINDOW)
  EndIf
  If(tbstate="H")
    SetWindowPos_(handleW1, 0, 0, 0, 0, 0, #SWP_HIDEWINDOW)
  EndIf
EndProcedure

showtaskbar("S")
;showtaskbar("H")
vince edwards
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

Hi, nice code.

Does this only work for Win XP or will it also work on Win 98 etc?

Regards.
I may look like a mule, but I'm not a complete ass.
dige
Addict
Addict
Posts: 1391
Joined: Wed Apr 30, 2003 8:15 am
Location: Germany
Contact:

Post by dige »

better use the windows constants:

Code: Select all

; ShowWindow
SetWindowPos_(handleW1, 0, 0, 0, 0, 0, #SWP_SHOWWINDOW) 

; HideWindow
SetWindowPos_(handleW1, 0, 0, 0, 0, 0, #SWP_HIDEWINDOW) 
lee__48
User
User
Posts: 21
Joined: Thu Dec 08, 2005 3:17 am
Location: UK

Post by lee__48 »

srod wrote:Hi, nice code.
Does this only work for Win XP or will it also work on Win 98 etc?
Regards.
I tested the following on Windows 2000 and 98. Works fine!

Code: Select all

SetWindowPos_(FindWindow_("Shell_traywnd", ""), 0, 0, 0, 0, 0, #SWP_HIDEWINDOW)
Delay(1200)
SetWindowPos_(FindWindow_("Shell_traywnd", ""), 0, 0, 0, 0, 0, #SWP_SHOWWINDOW)
Post Reply