Reputation: 81
I have the following Python code:
import ctypes
import ctypes.wintypes
import win32gui
user32 = ctypes.WinDLL("user32.dll")
# Define the window class
WNDCLASS = win32gui.WNDCLASS()
WNDCLASS.lpfnWndProc = ctypes.windll.user32.DefWindowProcW
WNDCLASS.hInstance = ctypes.windll.kernel32.GetModuleHandleW(None)
WNDCLASS.lpszClassName = "MyWindowClass"
# Register the window class
win32gui.RegisterClass(WNDCLASS)
# Create & style the window
style = 0x00040000 # See WS_SIZEBOX on https://learn.microsoft.com/en-us/windows/win32/winmsg/window-styles
hwnd = ctypes.windll.user32.CreateWindowExW(0, WNDCLASS.lpszClassName, "My Window Title".encode('utf-8'), style, 100, 100, 640, 480, None, None, WNDCLASS.hInstance, None)
user32.SetWindowLongPtrA(hwnd, -16, style) # See https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-setwindowlongptra
# Show the window
ctypes.windll.user32.ShowWindow(hwnd, 5)
# Run the message loop
msg = ctypes.wintypes.MSG()
while ctypes.windll.user32.GetMessageW(ctypes.byref(msg), None, 0, 0) > 0:
ctypes.windll.user32.TranslateMessage(ctypes.byref(msg))
ctypes.windll.user32.DispatchMessageW(ctypes.byref(msg))
To run this code, you will need Python 3.10 & https://github.com/mhammond/pywin32 .
where Im attempting to style my window to display only a window frame to allow for window resizing. I want to remove the titlebar entirely.
However, Im having this thin white bar at the top that I cant seem to figure out how to get rid of, does anyone know what this white bar is & how I can remove it?
This is what the window looks like: https://youtu.be/pU3TLLcBeio I also have a slightly more complex app that makes the white line more visually apparent (I wont share the code for this one as its several files, but the window styling is essentially the same so Im hoping that if I figure out how to remove the white bar on my smaller example app I will also be able to port the solution to this one):
Any thoughts or knowledge appreciated 💖
Upvotes: 1
Views: 194