SAMPLE: SCLBLDLG - Demonstrates Scaleable Controls in Dialog

Last reviewed: February 15, 1996
Article ID: Q112639
The information in this article applies to:
  • Microsoft Windows Software Development Kit (SDK) versions 3.1
  • Microsoft Win32 Application Programming Interface (API) included with:

        - Microsoft Windows NT versions 3.5 and 3.51
        - Microsoft Windows 95 version 4.0
    

SUMMARY

In certain circumstances it is desirable to dynamically scale the controls in a dialog box to the size of the dialog box window. SCLBLDLG.EXE is a file in the Microsoft Software Library that contains sample code implementing scaleable controls in a dialog box.

SCLBLDLG can be downloaded as a self-extracting file from the Microsoft Software Library (MSL) on the following services:

  • Microsoft Download Service (MSDL)

          Dial (206) 936-6735 to connect to MSDL
          Download SCLBLDLG.EXE (size: 29032 bytes) 
    
  • Internet (anonymous FTP)

          ftp ftp.microsoft.com
          Change to the \SOFTLIB\MSLFILES directory
          Get SCLBLDLG.EXE (size: 29032 bytes) 
    

MORE INFORMATION

To accomplish scaleable controls in a dialog box, the following messages are processed:

   WM_INITDIALOG - To store original dimensions of the dialog box and all
   its controls, together with the font the dialog box uses. The original
   dimensions are stored using SetProp() in this sample. The font handle is
   stored in a static variable to be used with in WM_SIZE.

   WM_SIZE - To calculate the scaling factor, and then scale up or down the
   font and all the controls in the dialog box.

   WM_GETMINMAXINFO - To set the minimum size of the dialog box so the
   controls are not truncated.

   WM_COMMAND - To clean up when closing the dialog box. RemoveProp() is
   called to remove the stored dimensions from the property list of the
   dialog box window and all its child control windows.

NOTE: Special processing is required for calculating the dimensions of CBS_DROPDOWN and CBS_DROPDOWNLIST style combo boxes. GetWindowRect() returns the dimensions of the edit portion of the combo box, excluding the drop-down list. To get the correct height for such combo boxes, the value returned by CB_GETDROPPEDCONTROLRECT is used instead of GetWindowRect().


Additional reference words: 3.10 3.50 3.51 4.00 95 proportional sizing
softlib
KBCategory: kbui kbfile
KBSubcategory: UsrDlgs



THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: February 15, 1996
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.