DialogProc: Difference between revisions
Appearance
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..." |
m →Remarks |
||
| (2 intermediate revisions by 2 users not shown) | |||
| Line 2: | Line 2: | ||
==Syntax== | ==Syntax== | ||
DialogProc(hwnd, usmsg, mpParam1, mpParam2) | DialogProc(hwnd, usmsg, mpParam1, mpParam2) | ||
==Parameters== | ==Parameters== | ||
| Line 15: | Line 15: | ||
==Remarks== | ==Remarks== | ||
This procedure is the same as any other window procedure, except that it can receive predefined window messages specific to dialog box windows. | 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. | ;''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. | 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== | ==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); | ||
</pre> | </pre> | ||
[[Category:Procedures]] | [[Category:Hooks and Procedures]] | ||
Latest revision as of 17:20, 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);