本文介绍了如何从本机应用程序获取窗口打开/关闭/最小化消息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

很难为这个标题写一个好标题.

It's tough to write a good title for this one.

我正在开发一个 WPF 应用程序,它需要知道系统上是否存在所有其他打开的窗口.我可以通过调用本机 EnumWindows 方法来做到这一点,我可以调用其他本机方法来过滤掉我感兴趣的窗口.这很有效.

I'm working on a WPF application which needs to know about the existence of all other open windows on the system. I'm able to do this by calling the native EnumWindows method just fine, and I can call other native methods to filter out just the windows I'm interested in. This works well.

我遇到的问题是我想知道窗口何时打开或关闭(理想情况下是最小化).我可以通过使用 EnumWindows 进行轮询来做到这一点,但我发现这很慢,即使我将其推送到另一个线程.

The problem I'm having is that I want to know when a window is opened or closed (and, ideally, minimized). I can do this by polling with EnumWindows, but I'm finding that to be pretty slow, even if I push it off to another thread.

有没有更好的方法来获取窗口打开/关闭/最小化的通知?请记住,我对非托管代码的了解非常有限.

Is there a better way to get notifications of window opened/closed/minimized? Keep in mind that my knowledge of non-managed code is pretty limited.

推荐答案

WM_WINDOWPOSCHANGING Message

WM_WINDOWPOSCHANGING Message

http://msdn.microsoft.com/en-us/library/ms632653%28VS.85%29.aspx

这篇关于如何从本机应用程序获取窗口打开/关闭/最小化消息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-23 07:17