Global floating plain window without titlebar

I am trying to create a plain window that appears at the front of all other windows without a titlebar and works on Mac and Windows. I have searched the forum and cant find a solution that works across both OSs, has anyone found a way to do this please. Thanks

On Windows, look at the CustomWindowShape project in Platform Specific example projects.

It enables you to create whatever window shape you want. It should be very difficult to create a mask for a floating window that renders invisible the titlebar.

You may also want to try this in the Open event of the floating window:

Const GWL_STYLE = -16
Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (hwnd As Integer, nIndex As Integer, dwNewLong As Integer) As Integer
 dim rien as integer = SetWindowLong(self.handle, GWL_STYLE, &H800000)

I did not test it, but it may do the trick.

For Mac, see https://forum.xojo.com/4514-round-transparent-window/14

Where solutions with Declare and plugins are mentioned.

See:
https://forum.xojo.com/conversation/post/438517

In a quick test that seemed for work for Mac and Windows for a floating window, but I did not try it for a global floating window.

i have no clue about Linux

  • karen

OverlayMBS might be another alternative.

This worked for me in one occasion.

The Mac part uses MBS, but you can change it with a Declare if you want. Just search the Apple Developer docs for NSWindow.

Set the window frame to Global Floating in the IDE

[code]#if targetmacOS
self.NSWindowMBS.styleMask = NSWindowMBS.NSMiniaturizableWindowMask
#else
const SWP_NOMOVE = &H2
const SWP_FRAMECHANGED = &H20
const HWND_TOPMOST = -1
const HWND_TOP = 0
const GWL_STYLE = -16
const WS_POPUPWINDOW = &H80880000
const WS_MINIMIZEBOX = &h00020000

Dim styleFlags As Integer

Declare Function SetWindowLong Lib “user32” Alias “SetWindowLongA” (hwnd As Integer, nIndex As Integer, dwNewLong As Integer) As Integer
Declare Function SetWindowPos Lib “user32” (hwnd as Integer, hWndInstertAfter as Integer, x as Integer, y as Integer, cx as Integer, cy as Integer, flags as Integer) as Integer

styleFlags = SetWindowLong( self.WinHWND, GWL_STYLE, WS_POPUPWINDOW )
styleFlags = BitwiseOr(SetWindowLong( self.WinHWND, GWL_STYLE, WS_MINIMIZEBOX), styleflags)
styleFlags = BitWiseOr(styleFlags, SWP_FRAMECHANGED)
styleFlags = BitwiseOr( SWP_FRAMECHANGED, SWP_NOMOVE )
styleFlags = SetWindowPos(self.WinHWND, HWND_TOP, 0, 0, self.width, self.height, styleFlags)
#endif[/code]

This works great thanks :slight_smile:

Incidentally, this is the same GWL_STYLE = -16 as what I posted above…

Thanks everyone