Removing windows from the taskbar, Windows 7

淺唱寂寞╮ 提交于 2019-12-19 11:47:16

问题


I have a little Tkinter application here, as well as a handle to the Tkinter window. What I'm trying to do is remove the window from the taskbar using some combination of Windows API calls. Basically I don't want the window to show up in the task bar.

import Tkinter as tk
import string

import win32ui
import win32con

root = tk.Tk()

handle = string.atoi(root.wm_frame(), 0)
winhandle = win32ui.CreateWindowFromHandle(handle)

root.mainloop()

回答1:


I hope this helps, or at least guides you somehow. I'm not sure how to do this in python, but speaking for the winapi part, this has to do with the window ex style. This is what MSDN says:

The Shell creates a button on the taskbar whenever an application creates a window that isn't owned. To ensure that the window button is placed on the taskbar, create an unowned window with the WS_EX_APPWINDOW extended style. 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.

Complete reference here|

In C or C++ you specify the ex style when you create the window with CreateWindowEx. You can also modify the style after a window is created with SetWindowLongPtr.

Edit: I found this very promising python method: PyCWnd.ModifyStyleEx



来源:https://stackoverflow.com/questions/7128434/removing-windows-from-the-taskbar-windows-7

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!