Jump to content

DialogProc: Difference between revisions

From EDM2
No edit summary
Ak120 (talk | contribs)
mNo edit summary
Line 2: Line 2:


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


==Parameters==
==Parameters==
Line 19: Line 19:


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.
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==
* [[WM_CREATE]]
* [[WM_INITDLG]]


==Example Code==
==Example Code==
Line 35: Line 31:
MRESULT mresReply;/* Message-return data. */
MRESULT mresReply;/* Message-return data. */


mresReply = DialogProc(hwnd, usmsg, mpParam1,
mresReply = DialogProc(hwnd, usmsg, mpParam1, mpParam2);
          mpParam2);
</pre>
</pre>


[[Category:Hooks and Procedures]]
[[Category:Hooks and Procedures]]

Revision as of 17:19, 26 October 2025

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.

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);