Removing the title bar from a floating window

Does anyone have any declares they are willing to share to remove the title bar and close buttons from a floating window on macOS, Windows (and if possible GTK)? I don’t want to use a plain box / modal window frame type because I need the other app windows to remain interactive whilst the titlebar-less window is frontmost.

If it’s ok for you, it’ll be easier to have a plain box that you tell to be always on top rather than a floating window that you tell to have no title bar.
There are declares for each 3 systems to tell a window to float above other windows. Removing the titlebar of an existing window… I’m only aware of a Windows way. :thinking:

@GarryPettet Did you locate the Windows code for this? If not I have a few questions for you before I answer this as the answers will determine how complex the answer is.

Yep. I can share it. Just away from my computer at the moment, I’ll post the code a bit later.

1 Like

Here’s a super simple example project hiding the title bar for a floating window using declares on all three platforms. Thanks to @Sam_Rowlands for pointing me in the correct direction to doing it on macOS.

Binary Project Link


Thanks for the example. Do you know, how to modify the code for DesktopWindow from API 2? I get this Error:

Parameter “NSWindowInstance” expects type Integer, but this is type Ptr.
AppKit.NSWindowSetStyleMask(Me.Handle) = AppKit.NSWindowStyleMaskBorderless

Does WinHWND still work?
The docs say it is deprecated, but have nothing to explain why the integer Handle on Windows is now a Ptr instead of an integer.
It may be a pointer TO an integer , but…?

Change this :

Protected Sub NSWindowSetStyleMask(NSWindowInstance As ptr, Assigns value As Integer)


Oh, so easy. Thanks a lot.