Page 1 of 1
Window with no titlebar or taskbar icon? [SOLVED]
Posted: Fri Aug 17, 2018 9:50 am
by mikejs
Hi,
I'm trying to have my app create a window that has all three of these characteristics:
- Borderless
- No titlebar
- No taskbar icon
The problem I'm running into is with getting both of the last two. If I use #PB_Window_Tool, I avoid the taskbar icon, but get a titlebar, and if I don't use it it's the other way around - no titlebar but a taskbar icon.
This program runs from the system tray and already has a system tray icon.
I'm guessing there are some Win api flags or similar I could use here - this is a Windows-only app so windows api calls are fine.
Any suggestions?
(Edit: To clarify, by "No taskbar icon", I mean no entry at all in the taskbar, not a taskbar entry that has no icon.)
Re: Window with no titlebar or taskbar icon?
Posted: Fri Aug 17, 2018 9:55 am
by RSBasic
It is not possible to create a taskbar entry without an icon.
You can create a titlebar with or without an icon.
Re: Window with no titlebar or taskbar icon?
Posted: Fri Aug 17, 2018 10:01 am
by mikejs
RSBasic wrote:It is not possible to create a taskbar entry without an icon.
You can create a titlebar with or without an icon.
Sorry, I may have been unclear...
I don't want the taskbar entry at all. I'm not asking for a taskbar entry with no icon.
From the help, #PB_Window_Tool "Creates a window with a smaller titlebar and no taskbar entry". What I'm after is no taskbar entry, but also no titlebar on the window.
Re: Window with no titlebar or taskbar icon?
Posted: Fri Aug 17, 2018 10:04 am
by RSBasic
Ah
Code: Select all
EnableExplicit
Procedure HideFromTaskBar(hWnd.i, Flag.l)
Protected TBL.ITaskbarList
CoInitialize_(0)
If CoCreateInstance_(?CLSID_TaskBarList, 0, 1, ?IID_ITaskBarList, @TBL) = #S_OK
TBL\HrInit()
If Flag
TBL\DeleteTab(hWnd)
Else
TBL\AddTab(hWnd)
EndIf
TBL\Release()
EndIf
CoUninitialize_()
DataSection
CLSID_TaskBarList:
Data.l $56FDF344
Data.w $FD6D, $11D0
Data.b $95, $8A, $00, $60, $97, $C9, $A0, $90
IID_ITaskBarList:
Data.l $56FDF342
Data.w $FD6D, $11D0
Data.b $95, $8A, $00, $60, $97, $C9, $A0, $90
EndDataSection
EndProcedure
If OpenWindow(0, 0, 0, 500, 250, "Window", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
HideFromTaskBar(WindowID(0),1)
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf
Re: Window with no titlebar or taskbar icon?
Posted: Fri Aug 17, 2018 10:12 am
by Marc56us
For no taskbar, according to a Rashd tip, a pure PB solution
Code: Select all
; --- False window invisible
; --- Real window child of false window
OpenWindow(0, 0, 0, 0, 0, "", #PB_Window_Invisible)
OpenWindow(1, 0, 0, 500, 300, "", #PB_Window_SystemMenu | #PB_Window_ScreenCentered, WindowID(0))
While WaitWindowEvent() <> #PB_Event_CloseWindow : Wend
So borderless, no title, no taskbar
(Left click on window to quit)
Code: Select all
; --- False window invisible
; --- Real window child of false window
OpenWindow(0, 0, 0, 0, 0, "", #PB_Window_Invisible)
OpenWindow(1, 0, 0, 500, 300, "", #PB_Window_ScreenCentered | #PB_Window_BorderLess, WindowID(0))
While WaitWindowEvent() <> #PB_Event_LeftClick : Wend
"small is beautiful - PB is great"

Re: Window with no titlebar or taskbar icon?
Posted: Fri Aug 17, 2018 10:29 am
by mikejs
Thanks!
I've quickly tried both of these, and they both work fine, but Marc56us's approach is simpler.
Thanks for the quick replies

Re: Window with no titlebar or taskbar icon?
Posted: Sat Jun 27, 2020 4:49 am
by BarryG
RSBasic, your HideFromTaskBar() procedure is fantastic, but I need to know how to tell if a hWnd has a taskbar button already (so I can toggle it). Do you know how?
I know I can check for the #WS_EX_TOOLWINDOW style but not all hWnds have that style set. I also tried comparing two Notepad windows (one with a taskbar button, one without) with WinSpy++ but the style flags were the same for both, so that didn't help.
Any ideas? Thanks.