Window Resize question (MFC)

This is a discussion on Window Resize question (MFC) within the Windows Programming forums, part of the Platform Specific Boards category; Hi,
I want to make a window resizable, but I want to limit exactly how it can be resized. For ...

Window Resize question (MFC)

Hi,

I want to make a window resizable, but I want to limit exactly how it can be resized. For instance, I am drawing a game board and the board is exactly a square. So when the user resizes horizontally, I want the window to also grow vertically by the same amount. Also, I don't want the board to be less than some minimum size, so I want to disallow resizing if the window is getting too small.

My first guess is to handle WM_SIZE, and then use some Win32 API call to resize the window (based on input params) if they doesn't conform to my liking. Does this sound right or is there some other approach? And what would that API call be?

Thanks for the hint. I was trying to use WM_SIZING, and I ran into some problems, so much so that I decided to scrap this particular feature of the app until later.

Here were my problems:
WM_SIZING only works when the message handler is attached to the frame class. Ideally I would like it attached to the View, because then (presumably) the RECT that I will get passed will be the client area that I am about to resize. As it is, I have to deal with the whole window size--including the title bar, menu, and status bar. Now it turns out that I could care less about these other things; what I really want to do is resize the client portion of the window to be some certain size.
What I ended up doing was looking up the size of the client area, subtracting the height of the status bar if visible, then using subtracting the total height of the menu and status bar based on the difference between the input param to OnSizing and GetClientRect. The width was easy because it was always the width of the client area.
But then I was getting choppy resizing when I did this, presumably because I need to be aware of if the user is sizing the window to be larger or smaller, so that I know if I should round up to the next reasonable size window, or down.

And at that point I said to myself "This is BS. It should be easier than this..."