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

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.

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;

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.

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?

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.