在WndProc中处理AeroSnap消息 [英] Handling AeroSnap message in WndProc

查看:246
本文介绍了在WndProc中处理AeroSnap消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的C#.NET应用4,我用的WndProc 来处理一些信息大多涉及调整应用程序和全屏。

In my C# .NET 4 application, I use WndProc to process some messages mostly dealing with resizing the application to and from full screen.

现在我只是处理 SC_MAXIMIZE WM_NCLBUTTONDBLCLK 来确定窗口调整大小或从最大化状态(我知道我不需要的WndProc处理 SC_MAXIMIZE ,但 Form_Resize 似乎没有火一个 WM_NCLBUTTONDBLCLK 邮件应用程序的标题栏时,我双击。

Right now I am just handling SC_MAXIMIZE and WM_NCLBUTTONDBLCLK to determine if the window is being resized to or from a maximized state (I know I don't need WndProc to handle SC_MAXIMIZE, but Form_Resize didn't seem to fire for a WM_NCLBUTTONDBLCLK message when I double-click on the application's title bar.

现在我发现,如果我Aero对齐的窗口到屏幕顶部的最大化,无论是上述消息的张贴所以一定的逻辑关系不适用时,通过航空管理单元窗口最大化。我只是要处理的消息,如果窗口捕捉到屏幕的顶部,而不是右边或左边,或者如果窗口从最大化位置unsnappped。

Now I noticed that if I Aero Snap the window to the top of the screen to maximize it, neither of the above messages are posted so certain logic is not applied when the window is maximized via Aero Snap. I only want to handle the message if the window is snapped to the top of the screen rather than the right or left, or if a window is unsnappped from maximized position.

我找不到任何有关航空管理单元窗口的消息。有谁知道这些消息的任何引用的?

I couldn't find any of the window messages related to Aero Snap. Does anyone know of any references for those messages?

推荐答案

我猜有没有这里的任何特殊消息; Aero是可能只是使用普通的Win32 API - ShowWindow(SW_MAXIMIZE)和类似的。

I'm guessing there aren't any special messages here; Aero is likely just using the plain Win32 APIs - ShowWindow(SW_MAXIMIZE) and similar.

与SC_消息uderstand的事情是从菜单那些<青霉>请求的询问窗口调整大小/恢复/等本身,但这不是用于改变窗口的大小的唯一机制。什么是可能发生的事情是,当一个窗口得到SC_MAXIMIZE的DefWndProc通过调用的ShowWindow(SW_MAXIMIZE)实现这一点。

The thing to uderstand with the SC_ messages are that those are requests from a menu asking the window to resize/restore/etc itself, but that is not the only mechanism for changing the windows's size. What's probably happening is that when a window gets SC_MAXIMIZE, the DefWndProc implements this by calling ShowWindow(SW_MAXIMIZE).

您最好的最好的是听 WM_SIZE 消息,该消息的窗口接收,而不管是什么触发了尺寸变化:系统菜单,API或其他手段。特别是,lParam的会让你知道如果窗口最大化(SIZE_MAXIMIZED)或恢复(SIZE_RESTORED)。

Your best best is to listen to the WM_SIZE message, which the window receives, regardless of what triggered the size change: system menu, API, or other means. In particular, the lParam will let you know if the window was maximized (SIZE_MAXIMIZED) or restored (SIZE_RESTORED).

这篇关于在WndProc中处理AeroSnap消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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