使用C#包装程序从任务栏中删除应用程序? [英] Remove application from taskbar with C# wrapper?

查看:60
本文介绍了使用C#包装程序从任务栏中删除应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以为现有应用程序构建C#包装器,从而允许我将其从任务栏中删除?

Is there a way to build a C# wrapper for an existing application that will allow me to remove it from the taskbar?

更多信息:

我有一个我应该使用的计时器应用程序,但是没有,因为它不好...太烂了.参见 https://superuser.com/questions/92774/quickbooks-timer-replacement-windows

I have an timer app that I suppose to use but don't because it well... sucks. See https://superuser.com/questions/92774/quickbooks-timer-replacement-windows.

因此,为了减少它的吸引力,我想知道是否可以构建一个包装器,然后仅与该包装器进行交互.从任务栏上删除计时器,然后隐藏/显示我的应用,这将是朝着这个方向迈出的一步.

So to make it suck less I wonder if I can build a wrapper then just interact with that wrapper instead. Removing the timer from the taskbar and then having my app hid/show it would be a step in that direction.

另一种选择是对计时器进行逆向工程.但这是另一天的另一个项目.现在,我很乐意把东西藏起来.

The other option is to reverse engineer the timer. But that is another project for another day. Right now I would be happy with hiding the thing.

推荐答案

您需要找到任务栏中正在显示的窗口,并从其(扩展)样式中删除在任务栏中显示"位.这将涉及到Windows API级别.您将需要的功能是:

You would need to locate the window that is being represented in the taskbar, and remove the "show in taskbar" bit from its (extended) style. This will involve dropping down to the Windows API level. The functions you will need are:

您需要删除的扩展样式位为 WS_EX_APPWINDOW .

The extended style bit you need to remove is WS_EX_APPWINDOW.

有关限制使用 SetWindowLongPtr 来影响其他线程中的窗口的信息,请参阅SetWindowLongPtr文档,并可能需要调用 SetWindowPos 进行视觉更新.Windows甚至可能完全阻止您执行此操作(例如出于安全性或可用性的原因)

Please see the SetWindowLongPtr docs for info about restrictions on the use of SetWindowLongPtr to affect windows in other threads, and potentially needing to call SetWindowPos to cause a visual update. Windows may even prevent you from doing this altogether (e.g. for security or usability reasons)

我尚未对此进行测试,它可能取决于目标应用程序.最后,如果确实可行,它将完全从任务栏中删除该窗口,这在您重新显示该窗口时可能会造成混淆,因此您的应用可能希望在显示该窗口之前重新启用 WS_EX_APPWINDOW 样式.其他应用程序的窗口.

I haven't tested this and it may depend on the target application. Finally, if this does work it will remove the window from the taskbar altogether, which may be confusing when you re-show the window, so your app may want to re-enable the WS_EX_APPWINDOW style before showing the other app's window.

这篇关于使用C#包装程序从任务栏中删除应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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