Resizing Window border sticks (with Fix)

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • Resizing Window border sticks (with Fix)

      Noticing a bug with the code in GCC.

      The issue I found was with the app custom MsgProc and the OnSysCommand function.

      When processing the WM_SYSCOMMAND message you call OnSysCommand(wParam, lParam).

      Everything other than SC_MAXIMIZE AND SC_CLOSE is being sent a Default case that is calling DefWindowProc.

      When you click on the border of a window as if to resize the window it is sending a WPARAM of 0xF003 which does not seem to have a constant.

      The issue is that this calls DefWindowProc and then returns 0, which has DXUT call it a second time. This results in the mouse cursor sticking to the border of the window and not releasing until you click again.

      I am not sure if this is due in-fact to my implementation (since I am putting things together myself and not copying the book), but I've duplicated the result on XP, Vista, and Windows 7.

      The fix is to add a "case 0xF003: return 0;" to the OnSysCommand function so that when this happens you don't call DefWindowProc in the OnSysCommand and leave it to DXUT.

      Addendum:

      Noticing that it is wParam of 0xF003 on Vista and 0xF008 on XP. Still curious where these are coming from when clicking the border.

      2nd Addendum:

      Okay so I've found that it depends on where you click on the border of the Window! You get F001 for the upper left, F003 for the top, F002 for the right, F008 for the bottom right, etc.

      So basically anything F001 to F008 will trigger this issue.

      -Brett

      The post was edited 2 times, last by bwilliams ().