Jump to content

DialogProc

From EDM2
Revision as of 04:54, 13 April 2025 by Martini (talk | contribs) (Created page with "This is a window procedure that automatically subclasses each instance of a dialog box. ==Syntax== DialogProc(hwnd, usmsg, mpParam1, mpParam2); ==Parameters== ;''hwnd'' (HWND) - input: Handle of the window to which the message applies. ;''usmsg'' (USHORT) - input: Message identity. ;''mpParam1'' (MPARAM) - input: Message parameter 1. ;''mpParam2'' (MPARAM) - input: Message parameter 2. ==Returns== ;''mresReply'' (MRESULT) - returns: Message-return data. ==Remarks== T...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This is a window procedure that automatically subclasses each instance of a dialog box.

Syntax

DialogProc(hwnd, usmsg, mpParam1, mpParam2);

Parameters

hwnd (HWND) - input
Handle of the window to which the message applies.
usmsg (USHORT) - input
Message identity.
mpParam1 (MPARAM) - input
Message parameter 1.
mpParam2 (MPARAM) - input
Message parameter 2.

Returns

mresReply (MRESULT) - returns
Message-return data.

Remarks

This procedure is the same as any other window procedure, except that it can receive predefined window messages specific to dialog box windows.

Note: It does not receive the WM_CREATE message, but the same information is carried by the WM_INITDLG message, that is generated during the creation of a dialog-box window.
hwnd is always the window handle of the dialog-box window.

The dialog procedure typically processes only some of the messages passed to it. Any messages that it does not process must be passed to WinDefFileDlgProc if the dialog box is the standard file selection dialog, WinDefFontDlgProc if the dialog box is the standard font selection dialog box, or for all other dialog boxes, WinDefDlgProc (not WinDefWindowProc), because these perform the standard dialog-box processing for those messages.

Related Messages

Example Code

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

HWND    hwnd;     /* Handle of the window to which the message applies. */
USHORT  usmsg;    /* Message identity. */
MPARAM  mpParam1; /* Message parameter 1. */
MPARAM  mpParam2; /* Message parameter 2. */
MRESULT mresReply;/* Message-return data. */

mresReply = DialogProc(hwnd, usmsg, mpParam1,
          mpParam2);