Adding Default Size to the System Menu

The WinInsertDefaultSize adds the Default Size selection to the system menu of the secondary window. This call should be made during the initialization of the secondary window.

When the user selects Default Size from the system menu, an SC_DEFAULTSIZE system command is sent to the secondary window procedure, which calls WinDefaultSize to size the window to its optimal default size.

#define INCL_SECONDARYWINDOW
#include <sw.h>

HWND hwndFrame

hwndFrame = WinLoadSecondaryWindow (HWND_DESKTOP, /* Parent window  */
                                    HWND_DESKTOP, /* Owner window   */
                                    MyDlgProc,    /* Dialog proc    */
                                    NULL,         /* Module handle  */
                                    ID_DIALOG,    /* Resource ID    */
                                    NULL);        /* Create params  */

WinInsertDefaultSize (hwndFrame, "~Default size"); /* Insert
                                                      menu item     */

WinDefaultSize (hwndFrame);          /* Set window to its
                                        default size                */


[Back: Secondary Window Message Box]
[Next: Multimedia I/O File Services]