Last active
April 5, 2026 21:10
-
-
Save CostaFot/0b5209ccca91cef7cfabeeac804529c1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Define which Windows functions we need | |
| internal interface User32 : Library { | |
| fun FindWindowA(className: String?, windowTitle: String?): Pointer? | |
| fun GetWindowLongA(hwnd: Pointer, index: Int): Int | |
| fun SetWindowLongA(hwnd: Pointer, index: Int, newStyle: Int): Int | |
| } | |
| class WindowsWindowStyleHelper : WindowStyleHelper { | |
| // JNA loads the actual Windows DLL at runtime | |
| val user32 = Native.load("user32", User32::class.java) | |
| override fun hideFromTaskbar(windowTitle: String) { | |
| val hwnd = user32.FindWindowA(null, windowTitle) ?: return | |
| val style = user32.GetWindowLongA(hwnd, GWL_EXSTYLE) | |
| user32.SetWindowLongA(hwnd, GWL_EXSTYLE, | |
| (style or WS_EX_TOOLWINDOW) and WS_EX_APPWINDOW.inv() | |
| ) | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment