标题栏未收到WM_NCHitTest [英] Not receiving WM_NCHitTest on title bar

查看:50
本文介绍了标题栏未收到WM_NCHitTest的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我注意到当光标位于标题栏内(不在边框上)时,没有将WM_NCHitTest消息发送到表单.

I noticed that the message WM_NCHitTest isn't sent to a form when the cursor is inside the caption bar (not on the border).

我尝试使用任一方法拦截它

I tried to intercept it using either

procedure WMNCHitTest(var Message: TWMNCHitTest); message WM_NCHITTEST;

procedure WndProc(var Message: TMessage); override;

根据MSDN,我希望在任何时候都可以收到它,没有盲点.

According to MSDN I was expecting to receive it for any point, with no blind spots.

我错过了什么吗,或者这是预期的行为?

Did I miss something or this is the intended behaviour?

我正在Windows 7上使用Delphi 2010,并已启用Aero.

I'm using Delphi 2010 on Windows 7, with Aero on.

推荐答案

是的-这是预期的.除非禁用DWM,否则当光标位于标题栏中时,您将不会收到WM_NCHITTEST消息.基本上,当DWM打开时,标题栏属于" DWM,而不是您的应用程序.

Yes -- that's expected. Unless you disable the DWM, you won't get WM_NCHITTEST messages when the cursor is in the title bar. Basically, when the DWM is on, the title bar "belongs" to the DWM, not your application.

如果您确实需要这些消息,则可以禁用DWM,但是请记住,当/如果这样做,它会 not 只是为您的应用程序禁用它.如果禁用它,则整个系统都将禁用它(当然,直到再次将其重新启用).

If you really need those messages, you can disable the DWM -- but keep in mind that when/if you do this, it does not just disable it for your application. If you disable it, it's disabled for the whole system (until it's re-enabled again, of course).

这篇关于标题栏未收到WM_NCHitTest的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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