WinDefDlgProc: Difference between revisions
Created page with "This function invokes the default dialog procedure with hwndDlg, msg, mp1, and mp2. ==Syntax== WinDefDlgProc(hwndDlg, msg, mp1, mp2) ==Parameters== ; hwndDlg (HWND) - input..." |
mNo edit summary |
||
Line 1: | Line 1: | ||
This function invokes the default dialog procedure with hwndDlg, msg, mp1, and mp2. | This function invokes the default dialog procedure with hwndDlg, msg, mp1, and mp2. | ||
==Syntax== | ==Syntax== | ||
WinDefDlgProc(hwndDlg, msg, mp1, mp2) | WinDefDlgProc(hwndDlg, msg, mp1, mp2) | ||
==Parameters== | ==Parameters== | ||
; hwndDlg (HWND) - input | ; hwndDlg (HWND) - input:Dialog-window handle. | ||
:Dialog-window handle. | ;msg (ULONG) - input:Message identity. | ||
;mp1 (MPARAM) - input:Parameter 1. | |||
;mp2 (MPARAM) - input:Parameter 2. | |||
; | ==Returns== | ||
:Message | ;mresReply (MRESULT) - returns:Message-return data. | ||
==Errors== | ==Errors== | ||
Possible returns from WinGetLastError | Possible returns from WinGetLastError | ||
;PMERR_INVALID_HWND (0x1001) | ;PMERR_INVALID_HWND (0x1001):An invalid window handle was specified. | ||
:An invalid window handle was specified. | |||
==Remarks== | ==Remarks== | ||
Line 31: | Line 23: | ||
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 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. | 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== | ==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. | 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. | ||
<pre> | <pre> | ||
#define INCL_WINDIALOGS /* Window Dialog Mgr Functions | #define INCL_WINDIALOGS /* Window Dialog Mgr Functions */ | ||
#include <os2.h> | #include <os2.h> | ||
Line 75: | Line 67: | ||
* WinGetDlgMsg | * WinGetDlgMsg | ||
* WinLoadDlg | * WinLoadDlg | ||
* WinProcessDlg | * WinProcessDlg | ||
[[Category:Win]] | [[Category:Win]] |
Revision as of 14:44, 16 May 2023
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
- WinCreateDlg
- WinDismissDlg
- WinDlgBox
- WinGetDlgMsg
- WinLoadDlg
- WinProcessDlg