Handling WM_SIZING for Dialogs

Posted on 1998-01-27
Last Modified: 2013-11-19
I have a dialog box implementing Grid view of a Database.
The dialog contains a maximize/minimize button. I'd also
like to implement Onsizing for the Dialog but ClassWizard
does not provide this event for my dialog (It only provides
WM_SIZE which is good only for minimize/maximize).

ClassWizard however provides this event for the ActiveX control
that owns the dialog.

How do I proceed with this quest? Any pointers appreciated.
Question by:hakeem042997
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2

Accepted Solution

tflai earned 100 total points
ID: 1314976
I'm not sure what you mean.  But you can resize a dialog box by changing its border style from "dialog frame" to "resizing".  In your WM_SIZE's OnSize() handler, you will know what size the user is setting it to be, and you can re-size/re-arrange controls in the dialog box.  Catch WM_GETMINMAXINFO to set the maximum/minimum size if you want to do it.
(WM_SIZE is sent whenever dialog is re-sized, not only on maximize/minimize.)

Author Comment

ID: 1314977
Thanks. But WM_GETMINMAXINFO is not available to be handled for my
dialog. It's only available ffor the ocx. Now is it enough to just
override OnGetMinMaxInfo() and call that inside OnSize().

More info appreciated.

Expert Comment

ID: 1314978
Add DefWindowProc() handler for your dialog box in the class wizard:

      lppt = (LPPOINT)lParam;   // lParam points to array of POINTs
      lppt[3].x = MinDialogSize.x;
      lppt[3].y = MinDialogSize.y;
      lppt[4].x = MaxDialogSize.x;
      lppt[4].y = MaxDialogSize.y;
      return DefWindowProc(hWnd, message, wParam, lParam);
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Author Comment

ID: 1314979
Thanks again, tflai. Looks like what 'am looking for.

Author Comment

ID: 1314980
Thanks again, tflai. Looks like what 'am looking for.

Author Comment

ID: 1314981
Thanks again, tflai. Looks like what 'am looking for.

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

717 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question