Hide Program on Task Bar

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
LJ
Enthusiast
Enthusiast
Posts: 177
Joined: Wed Apr 30, 2003 4:00 pm

Hide Program on Task Bar

Post by LJ »

A command like: HideProgramFromTaskbar.

Or maybe that's too long. Maybe another flag on the HideWindow command, number 2. This would prevent the program that is running from being displayed on the task bar.
CS2001
User
User
Posts: 14
Joined: Mon Jun 09, 2003 6:17 pm
Location: Germany
Contact:

Post by CS2001 »

You can try this, until this Feature is added:

Code: Select all

OpenWindow(0,0,0,50,50,#PB_Window_ScreenCentered,"Not needed")
HideWindow(0, 1)
OpenWindow(1,0,0,400,100,#PB_Window_ScreenCentered|#PB_Window_SystemMenu, "Not shown in the Taskbar",WindowID(0))
Repeat
  EventID=WaitWindowEvent()
Until EventID=#PB_Event_CloseWindow
CS2001

edit: Oh, haven't read the post in the Beginners Section. Perhaps you could use a Please Wait window.
CS2001
User
User
Posts: 14
Joined: Mon Jun 09, 2003 6:17 pm
Location: Germany
Contact:

Post by CS2001 »

Now i have it. Try this:

Code: Select all

;Autor: Christian Stransky (CS2001)
;Datum: 15.8.03 

Procedure HideWindowFromShowingInTaskbar(WindowID, NewWindowHandle, show)
  If show=1
    HideWindow(WindowID,1)
  EndIf
  SetWindowLong_(WindowID(WindowID),#GWL_HWNDPARENT,NewWindowHandle)
  If show=1
    HideWindow(WindowID,0)
  EndIf
  ProcedureReturn 
EndProcedure

OpenWindow(1, 0, 0, 0, 0, #PB_Window_ScreenCentered, "Not Needed")
HideWindow(1,1)

OpenWindow(0,0,0,400,100,#PB_Window_ScreenCentered|#PB_Window_SystemMenu, "Not shown in the Taskbar")
CreateGadgetList(WindowID())
  ButtonGadget(0, 0, 0, 200, 100, "Hide Window from showing in Taskbar")
  ButtonGadget(1, 200, 0, 200, 100, "Show Window in Taskbar")
  DisableGadget(1,1)
  
Repeat
  EventID=WaitWindowEvent()
  Select EventID
    Case #PB_Event_Gadget
      Select EventGadgetID()
        Case 0
          HideWindowFromShowingInTaskbar(0, WindowID(1), 0) 
          DisableGadget(0,1)
          DisableGadget(1,0)
        Case 1
          HideWindowFromShowingInTaskbar(0, 0, 1)
          DisableGadget(0,0)
          DisableGadget(1,1)
      EndSelect
  EndSelect
Until EventID=#PB_Event_CloseWindow
I hope it helps. I've tested it under WindowsXP. I hope it works on other Sytems too.
CS2001
LJ
Enthusiast
Enthusiast
Posts: 177
Joined: Wed Apr 30, 2003 4:00 pm

Nice

Post by LJ »

@CS2001,

Greetings and nice coding. It works great, thank you.
Post Reply