Jump to content

WinDefDlgProc

From EDM2

This function invokes the default dialog procedure with hwndDlg, msg, mp1, and mp2.

Syntax

WinDefDlgProc(hwndDlg, msg, mp1, mp2)

Parameters

hwndDlg (HWND) - input
Dialog-window handle.
msg (ULONG) - input
Message identity.
mp1 (MPARAM) - input
Parameter 1.
mp2 (MPARAM) - input
Parameter 2.

Returns

mresReply (MRESULT) - returns
Message-return data.

Errors

Possible returns from WinGetLastError

PMERR_INVALID_HWND (0x1001)
An invalid window handle was specified.

Remarks

The action taken by the default dialog procedure is such that the values passed in mp1 and mp2, and the values returned in mresReply are defined for each msg.

The default dialog procedure provides default processing for any dialog window messages that an application chooses not to process. It can be used to ensure that every message is processed and is called with the same parameters that were received by the dialog procedure.

The action of the WinDefDlgProc function on receiving messages is precisely the same as for the frame window procedure except for WM_CLOSE messages where WinDismissDlg will be called. If an application processes a message instead of sending it to the WinDefDlgProc function, it may be required to perform some or all of the frame window procedure actions for itself.

Example Code

This example shows a typical dialog box procedure. A switch statement is used to process individual messages. All messages not processed are passed on to the WinDefDlgProc function.

#define INCL_WINDIALOGS         /* Window Dialog Mgr Functions */
#include <os2.h>

MRESULT AboutDlg(HWND hwnd, ULONG  ulMessage, MPARAM mpParam1,
                          MPARAM mpParam2)
{
    switch (ulMessage) {

        /*
         * Process whatever messages you want here and send the rest
         * to WinDefDlgProc.
         */

        default:
            return (WinDefDlgProc(hwnd, ulMessage, mpParam1, mpParam2));
    }
}

Definition

#define INCL_WINDIALOGS /* Or use INCL_WIN, INCL_PM, Also in COMMON section */
#include <os2.h>

HWND       hwndDlg;    /*  Dialog-window handle. */
ULONG      msg;        /*  Message identity. */
MPARAM     mp1;        /*  Parameter 1. */
MPARAM     mp2;        /*  Parameter 2. */
MRESULT    mresReply;  /*  Message-return data. */

mresReply = WinDefDlgProc(hwndDlg, msg, mp1, mp2);

Related Functions