0

How would I declare a pointer to MINMAXINFO that is passed to WPARAM

In WM_GETMINMAXINFO wParam is a pointer to a place on the stack that holds MINMAXINFO. I've tried

MINMAXINFO *Info;
Info = MINMAXINFO *wParam;

and several other variations to no avail.

Thanks

2
Contributors
5
Replies
6
Views
10 Years
Discussion Span
Last Post by Duoas
0

Just cast it the usual way:

LRESULT CALLBACK MyWndProc(
  HWND   hWnd,
  UINT   uMsg,
  WPARAM wParam,
  LPARAM lParam
  ) {
  if (uMsg == WM_GETMINMAXINFO) {
    cout << "Max Window Size is ("
         << ((LPMINMAXINFO)lParam)->x << ", "
         << ((LPMINMAXINFO)lParam)->y << ")"
         << endl;
    }
  return DefWindowProc( hWnd, uMsg, wParam, lParam );
  }

Hope this helps.

0

Thank-you Duoas, my adaptation is as follows and works as expected

case	WM_GETMINMAXINFO:
	((LPMINMAXINFO) lParam)->ptMinTrackSize.x = WndInfo.MaxWidth;
	((LPMINMAXINFO) lParam)->ptMaxTrackSize.x = WndInfo.MaxWidth;
	((LPMINMAXINFO) lParam)->ptMaxTrackSize.y = WndInfo.MaxHeight;
	((LPMINMAXINFO) lParam)->ptMinTrackSize.y = WndInfo.MinHeight;
   break;
0

Heh, nice job. Sorry I goofed in my example and left the ptMaxSize part out: ((LPMINMAXINFO)lParam)->ptMaxSize.x Good job on picking that up! Glad you got it working.

0

I also remebered the way I wanted to do it

LPMINMAXINFO  Info
        Info = LPMINMAXINFO (lParam)

I don't believe their is any advantage this way other than less to type and easier to read?

0

If your window procedure is small, then that way is an advantage because it is, in fact, less typing.

If your window procedure is very long then it is a disadvantage only because it separates what "info" is from where it is used.

But you are correct, they are otherwise identical.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.