def stay_on_bottom(self):
"""Pin to desktop or something close enough (call repeatedly)."""
if self.is_desktop_on_foreground():
if self.topmost is False:
win32gui.SetWindowPos(
self.hwnd, win32con.HWND_TOPMOST, 0, 0, 0, 0,
win32con.SWP_NOSIZE | win32con.SWP_NOMOVE)
self.topmost = True
else:
if self.topmost is True:
win32gui.SetWindowPos(
self.hwnd, win32con.HWND_BOTTOM, 0, 0, 0, 0,
win32con.SWP_NOSIZE | win32con.SWP_NOMOVE)
self.topmost = False
# "To prevent the window button from being placed on the taskbar, create
# the unowned window with the WS_EX_TOOLWINDOW extended style. As an
# alternative, you can create a hidden window and make this hidden window
# the owner of your visible window. The Shell will remove a window's button
# from the taskbar only if the window's style supports visible taskbar
# buttons. If you want to dynamically change a window's style to one that
# doesn't support visible taskbar buttons, you must hide the window first
# (by calling ShowWindow with SW_HIDE), change the window style, and then
# show the window."
# -- https://msdn.microsoft.com/en-us/library/bb776822%28v=vs.85%29.aspx
评论列表
文章目录