.NET (C#) 窗口最小化事件 [英] .NET (C#) Window Minimize Event

查看:35
本文介绍了.NET (C#) 窗口最小化事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿,我真的被我的项目困在这里...我需要知道任何打开的窗口何时被最小化/恢复并在我自己的应用程序中处理事件.有什么想法吗?

Hey, I'm really stuck with my project here... I need to know when any open window has been minimized / restored and Handle the event in my own App. Any ideas?

Musigenesis 是对的,我想知道其他应用程序何时最小化/恢复

Musigenesis is right, i do want to know when OTHER applications are minimized/restored

推荐答案

我认为您需要使用 SetWindowsHookEx Win32 API 函数(以及其他一些函数).基本上,您将遍历操作系统中所有打开的窗口并连接到它们的大小调整事件.

I think you would need to use the SetWindowsHookEx Win32 API function (along with a few others). Basically, you would iterate through all open windows in the OS and hook into their resizing events.

强制性评论:您确定需要这样做吗?虽然我认为这在理论上是可能的,但这听起来很糟糕,而且与 Windows 中应用程序的行为方式背道而驰.

Obligatory comment: are you sure you need to do this? While I think this is theoretically possible, it sounds like a pretty bad idea, and counter to the way applications in Windows are supposed to behave.

更新:我认为 Windows 中的显示桌面"有点像这样,除了它遍历所有打开的窗口,然后在打开时使用 SendMessage 将它们最小化(我完全猜测).

Update: I think "Show Desktop" in Windows works kind of like this, except that it iterates through all the open windows and then uses SendMessage to minimize them if open (total guess on my part).

更新 2:这是一个艰难的过程,我很想知道如何做到这一点(我 100% 确定它).我会密切关注这个问题,如果在接下来的一两天内没有人提出答案,我会再次发布并提供赏金(你可以这样做,但你需要一些您自己的声望点可以作为赏金提供).

Update 2: this is a tough one, and I'm very curious to know how this could be done (I'm 100% sure that it is possible). I'll keep an eye on this question, and if no one comes up with an answer in the next day or two, I'll post it again and offer a bounty on it (you could do that, but you need to have some reputation points of your own to offer as a bounty).

这篇关于.NET (C#) 窗口最小化事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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