Window with no titlebar or taskbar icon? [SOLVED]

Just starting out? Need help? Post your questions and find answers here.
mikejs
Enthusiast
Enthusiast
Posts: 166
Joined: Thu Oct 21, 2010 9:46 pm

Window with no titlebar or taskbar icon? [SOLVED]

Post by mikejs »

Hi,

I'm trying to have my app create a window that has all three of these characteristics:
  1. Borderless
  2. No titlebar
  3. 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.)
Last edited by mikejs on Fri Aug 17, 2018 10:32 am, edited 2 times in total.
User avatar
RSBasic
Moderator
Moderator
Posts: 1218
Joined: Thu Dec 31, 2009 11:05 pm
Location: Gernsbach (Germany)
Contact:

Re: Window with no titlebar or taskbar icon?

Post by RSBasic »

It is not possible to create a taskbar entry without an icon.
You can create a titlebar with or without an icon.
Image
Image
mikejs
Enthusiast
Enthusiast
Posts: 166
Joined: Thu Oct 21, 2010 9:46 pm

Re: Window with no titlebar or taskbar icon?

Post 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.
User avatar
RSBasic
Moderator
Moderator
Posts: 1218
Joined: Thu Dec 31, 2009 11:05 pm
Location: Gernsbach (Germany)
Contact:

Re: Window with no titlebar or taskbar icon?

Post 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
Image
Image
Marc56us
Addict
Addict
Posts: 1479
Joined: Sat Feb 08, 2014 3:26 pm

Re: Window with no titlebar or taskbar icon?

Post by Marc56us »

For no taskbar, according to a Rashd tip, a pure PB solution :D

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"

:wink:
mikejs
Enthusiast
Enthusiast
Posts: 166
Joined: Thu Oct 21, 2010 9:46 pm

Re: Window with no titlebar or taskbar icon?

Post 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 :D
BarryG
Addict
Addict
Posts: 3330
Joined: Thu Apr 18, 2019 8:17 am

Re: Window with no titlebar or taskbar icon?

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