[comp.windows.ms.programmer] Limiting size of a window when resizing

koziol@yoyodyne.ncsa.uiuc.edu (Quincey Koziol) (03/12/91)

Hi,
	Is there any way to limit the size a window may be resized to?  I have
tried trapping the WM_GETMINMAXINFO message, but either I am not modifying
the data structure which lParam points to correctly, or this is merely an
informative (as the name means, I suppose...) message, which doesn't really
do anything.  I know this can be done because the DOS windows in 386 mode
won't resize larger than their max correct size.  If someone could
give me a hand I would greatly appreciate it..

		Quincey Koziol
		Programmer
		NCSA

koziol@ncsa.uiuc.edu

bonneau@hyper.hyper.com (Paul Bonneau) (03/13/91)

In article <1991Mar11.211941.481@ux1.cso.uiuc.edu> koziol@yoyodyne.ncsa.uiuc.edu (Quincey Koziol) writes:
>Hi,
>	Is there any way to limit the size a window may be resized to?  I have
>tried trapping the WM_GETMINMAXINFO message, but either I am not modifying
>the data structure which lParam points to correctly, or this is merely an
>informative (as the name means, I suppose...) message, which doesn't really
>do anything.  I know this can be done because the DOS windows in 386 mode
>won't resize larger than their max correct size.  If someone could
>give me a hand I would greatly appreciate it..
>
WM_GETMINMAXINFO is intended for top-level windows, or
windows with sizeable borders (ie. popup windows).  It is
used when a window is sized via the system menu, or via the
sizing borders.

You did not say what type of window you want to control, but
in general, you can use the WM_NCCALCSIZE message to control
the final size.  For example, ListBoxes use this message to
ensure that the height of a list is an integral number of
entries.

cheers - Paul Bonneau.