[comp.windows.ms.programmer] handling WM_GETMINMAXINFO

merrill@cs.arizona.edu (Darren J. Merrill) (04/10/91)

Hi, excuse me for this stupid, trivial question, but here's my
problem.  I want to specify the lower limit on my window size, and
I know you can do this by processing the WM_GETMINMAXINFO message.
Now, the documentation says that the lParam for this msg is a pointer
to an array of 5 "points".  Does this mean an array of POINT structs?
I've tried to dereference it with this is mind, but the values do not
look correct (the default values that are supposed to be there).  
Could someone send me a code frag that shows the correct way to set
a value (or Point) in this array.  Email is fine.

Darren Merrill
merrill@cs.arizona.edu

billy@terminus.umd.edu (Billy Taylor) (04/10/91)

>>>Hi, excuse me for this stupid, trivial question, but here's my
>>>problem.  I want to specify the lower limit on my window size, and
>>>I know you can do this by processing the WM_GETMINMAXINFO message.
>>>Now, the documentation says that the lParam for this msg is a pointer
>>>to an array of 5 "points".  Does this mean an array of POINT structs?
>>>I've tried to dereference it with this is mind, but the values do not
>>>look correct (the default values that are supposed to be there).  
>>>Could someone send me a code frag that shows the correct way to set
>>>a value (or Point) in this array.  Email is fine.
>>>
>>>Darren Merrill
>>>merrill@cs.arizona.edu
 
Yes, Darren, lParam is an array of point structures.  I access lParam below
like a pointer to point structures.  With hMainWnd the HWND to the main
application window, and rect of type RECT, I use the segment below to
to set the maximum size of the child window (this is obviously in the child
window's window proc) to the current size of the client area of the main
application window.


ChildWindowProc (.......)
	:
	:
	:

     switch (msg) {
 	:
 	other cases
 	:
 	:
 	case WM_GETMINMAXINFO:
 		/* get the size of the main window client area */
 		GetClientRect (hMainWnd, &rect);
 
 		/* use that to compute the size of a maximized window */
 		((LPPOINT) lParam + 1) -> x = rect.right - rect.left; 
 		((LPPOINT) lParam + 1) -> y = rect.bottom - rect.top;
 		break;
 	:
 	:
 	other cases
 	:
     }

zim-zam,
billy.

-----------------------------------------------------------------------------
Billy E. Taylor, Jr.  | (301) 403-4611           |   War is Over,
Comp Sci Ctr, U of MD | billy@terminus.umd edu   |   If you want it -- j&y
College Pk, MD 20742  | Disclaimer: I don't know, maybe it's me...
-- 

zim-zam,
billy.

tedb@hpcvra.cv.hp.com. (Ted Beers) (04/11/91)

/ hpcvra.cv.hp.com:comp.windows.ms.programmer / merrill@cs.arizona.edu (Darren J. Merrill) /  1:56 pm  Apr  9, 1991 /
> Hi, excuse me for this stupid, trivial question, but here's my
> problem.  I want to specify the lower limit on my window size, and
> I know you can do this by processing the WM_GETMINMAXINFO message.
> Now, the documentation says that the lParam for this msg is a pointer
> to an array of 5 "points".  Does this mean an array of POINT structs?
> I've tried to dereference it with this is mind, but the values do not
> look correct (the default values that are supposed to be there).  
> Could someone send me a code frag that shows the correct way to set
> a value (or Point) in this array.  Email is fine.
> 
> Darren Merrill
> merrill@cs.arizona.edu

Please post the solution to this problem.  I am also interested, and so
are many others, I suspect.

Ted W. Beers
Hewlett-Packard

merrill@cs.arizona.edu (Darren J. Merrill) (04/11/91)

In article <36190003@hpcvra.cv.hp.com.> tedb@hpcvra.cv.hp.com. (Ted Beers) writes:
>/ hpcvra.cv.hp.com:comp.windows.ms.programmer / merrill@cs.arizona.edu (Darren J. Merrill) /  1:56 pm  Apr  9, 1991 /
(...my stuff deleted...)

>Please post the solution to this problem.  I am also interested, and so
>are many others, I suspect.
>
>Ted W. Beers
>Hewlett-Packard

My problem was that I was casting lParam to a pointer to a POINT, ie -
(POINT *)lParam.  But lParam is a FAR pointer!! So, you can just use
the symbolic constant given in windows.h LPPOINT (far pointer to tag_point
structure) to cast lParam and bingo - it works.
Sample code:
  case WM_GETMINMAXINFO:
    // to set the minimum size of the window:
    ((LPPOINT)lParam)[3].x = my_minimum_x;
    ((LPPOINT)lParam)[3].y = my_minimum_y;
    // that's it
    return 0;
Thanks again to everyone that mailed me and posted replies.  I guess I'm
too used to Unix.

Darren Merrill
merrill@cs.arizona.edu