How to programmatically disable snap for a window class

Holland, RD (DI SW ME PRD SDE AS) 36 Reputation points
2024-03-05T19:27:31.0633333+00:00

I have a MDI application and on Windows11 I have Snap enabled. Works fine with one oddity. If I do not have my application's MDI document maximized, when I move over the maximize button, the Snap window appears. I can click and entry and my application Snaps (not the MDI child window). How can I disable this as I only want the application to snap.

I added a handler for WM_NCHITTEST to my MDI child window but if I don't return HTMAXBUTTON, I get no highlighting on the button and it doesn't react to clicks. Spying on the messages the window gets I don't see anything that I might intercept to prevent Snap from showing up. I'm trying to avoid having to implement all the NC message handlers if possible.

badsnap

C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,693 questions
Windows 11
Windows 11
A Microsoft operating system designed for productivity, creativity, and ease of use.
9,468 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Holland, RD (DI SW ME PRD SDE AS) 36 Reputation points
    2024-03-07T13:16:54.7266667+00:00

    I tried that with a stock MFC sample but didn't get the Snap window. As with many issues, if it was simple to repro, it would not have made it out the door from Microsoft.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.