Window, DesktopWindow; Win 11; 2024r3.1;

I use this code to hide a windows border while using a WebView2 controlled window, see below.

When using this with DesktopWindow class, border of window as “plain box” is still shown.
When using this with Window ancestor, border of window as “plain box” is switched off and so is the task bar of the windows 11 desktop.

What is the difference between DesktopWindow and Window concerning Win API?
Is DesktopWindow with kept border a security feature (not to mess with user interface or similar)?

const GWL_STYLE              = -16 
const WS_BORDER              = &h00800000
var h as Integer             = self.Handle

declare function GetWindowLong lib "user32" alias "GetWindowLongA" (byVal hWnd as Integer, byVal nIndex as Integer) 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

var styleFlags as Integer 

styleFlags = GetWindowLong(h, GWL_STYLE)
styleFlags = styleFlags xor WS_BORDER
styleFlags = SetWindowLong(h, GWL_STYLE, styleFlags)

Thanks a lot in advance

Mismatched Integer and Ptr…
With Ptr it works with DesktopWindow. :roll_eyes: