从任务栏中删除窗口,Windows 7 [英] Removing windows from the taskbar, Windows 7

查看:38
本文介绍了从任务栏中删除窗口,Windows 7的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我这里有一个小 Tkinter 应用程序,以及一个 Tkinter 窗口的句柄.我想要做的是使用 Windows API 调用的某种组合从任务栏中删除窗口.基本上我不希望窗口显示在任务栏中.

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()

推荐答案

我希望这会有所帮助,或者至少能以某种方式指导您.我不确定如何在 python 中执行此操作,但就 winapi 部分而言,这与 window ex 样式有关.这是 MSDN 所说的:

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:

每当应用程序运行时,Shell 都会在任务栏上创建一个按钮创建一个不属于自己的窗口.确保窗口按钮是放置在任务栏上,创建一个无主窗口WS_EX_APPWINDOW 扩展样式.为了防止窗口按钮被放置在任务栏上,使用WS_EX_TOOLWINDOW 扩展样式.作为替代方案,您可以创建一个隐藏窗口并使这个隐藏窗口成为您可见的所有者窗口.

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.

此处完整参考|

在 C 或 C++ 中,您在使用 CreateWindowEx.您还可以在使用 SetWindowLongPtr.

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.

我发现这个非常有前途的 python 方法:PyCWnd.ModifyStyleEx

I found this very promising python method: PyCWnd.ModifyStyleEx

这篇关于从任务栏中删除窗口,Windows 7的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆