Aero Snap not working for my application
- by Magnus Österlind
I have a problem with Aero Snap not working with the application I'm working on (Windows desktop, native C++ application), and I'm a bit confused as to what's happening, as it seems like it should just work, out of the box.
I've used Spy++ on a mininal win32 application, and get the following messages when I press Win-Left:
<00070 00030D1C P WM_KEYDOWN nVirtKey:VK_LWIN cRepeat:1 ScanCode:5B fRepeat:0 fUp:0
<00071 00030D1C P WM_KEYDOWN nVirtKey:VK_LWIN cRepeat:1 ScanCode:5B fRepeat:1 fUp:0
<00072 00030D1C P WM_KEYDOWN nVirtKey:VK_LWIN cRepeat:1 ScanCode:5B fRepeat:1 fUp:0
<00088 00030D1C S WM_GETMINMAXINFO lpmmi:0043FCBC
<00089 00030D1C R WM_GETMINMAXINFO lpmmi:0043FCBC
<00090 00030D1C S WM_WINDOWPOSCHANGING lpwp:0043FCC4
<00091 00030D1C S WM_GETMINMAXINFO lpmmi:0043F8E8
<00092 00030D1C R WM_GETMINMAXINFO lpmmi:0043F8E8
<00093 00030D1C R WM_WINDOWPOSCHANGING
.. and so on
So I can see that the WM_KEYDOWN for the left key isn't reaching the application, but I'm getting the aero snap "resize window" stuff instead.
When I Spy++ my application, I can see that the left key isn't being "intercepted", but instead being passed on to the application, so I don't get any snapping goodness.
<00043 000F0F12 P WM_KEYDOWN nVirtKey:VK_LWIN cRepeat:1 ScanCode:5B fRepeat:0 fUp:0
<00044 000F0F12 P WM_KEYDOWN nVirtKey:VK_LWIN cRepeat:1 ScanCode:5B fRepeat:1 fUp:0
<00045 000F0F12 P WM_KEYDOWN nVirtKey:VK_LWIN cRepeat:1 ScanCode:5B fRepeat:1 fUp:0
<00060 000F0F12 P WM_KEYUP nVirtKey:VK_LEFT cRepeat:1 ScanCode:4B fRepeat:0 fUp:1
I'm going to dig into the cores of our message handling and see what's going on, but I'll take all the tips I can get :)