为什么有些窗口收不到 Windows 消息 [英] Why do some windows not receive Windows messages

查看:93
本文介绍了为什么有些窗口收不到 Windows 消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Visual Studio 上使用 Spy++ 工具我可以看到像桌面或资源管理器(文件资源管理器)这样的窗口接收 WM_ 消息,但像 Firefox 或 Visual Studio 这样的窗口不接收消息.

Using Spy++ tool on Visual Studio I can see that windows like the Desktop or Explorer(The File Explorer thing) receive WM_ messages, but windows like Firefox or Visual Studio do not receive messages.

为什么有的能收到消息,有的不能.

Why do some receive messages and others don't.

(通过 WM_ 消息,我指的是诸如 WM_MOUSELEAVEWM_SETCURSOR)

(By WM_ messages, I mean things like, WM_MOUSELEAVE or WM_SETCURSOR)

推荐答案

Spy++ 需要注入一个钩子来监控窗口消息.为此,钩子函数的位数需要与拥有窗口的进程的位数相匹配,因此您应该使用 32 位版本的 Spy++ 来监视 32 位应用程序的窗口,以及 64 位版本监控 64 位应用.

Spy++ needs to inject a hook to monitor window messages. For this to work, the bitness of the hook function needs to match the bitness of the process owning the window, and therefore you should use the 32-bit version of Spy++ to monitor windows of 32-bit apps, and the 64-bit version to monitor 64-bit apps.

(毕竟,这就是为什么要安装两个版本的 Spy++)

(That is, after all, why two versions of Spy++ get installed)

这篇关于为什么有些窗口收不到 Windows 消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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