News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Dialog box programming considerations

Started by kkurkiewicz, October 23, 2023, 02:18:34 AM

Previous topic - Next topic

jj2007

Quote from: kkurkiewicz on December 06, 2023, 06:34:12 AMDefDlgProc must be the system predefined procedure for the standard dialog box class

Yes.

Quote from: jj2007 on December 06, 2023, 03:31:52 AMIf the dialog box procedure returns FALSE, the dialog manager performs the default dialog operation in response to the message.

QuoteThe DefDlgProc function is the window procedure for the predefined class of dialog box. This procedure provides internal processing for the dialog box by forwarding messages to the dialog box procedure and carrying out default processing for any messages that the dialog box procedure returns as FALSE.

TimoVJL

Those who use message loop, IsDialogMessage() is usefull for input.
May the source be with you

kkurkiewicz

So to summarize, when something happens to the dialog, the message is first sent to the internal procedure, and only then the processing is delegated to the function defined in the program. If the application-defined procedure returns 0, the message is processed by the internal procedure; otherwise, the internal procedure doesn't handle the message.
Kamil

jj2007

Quote from: kkurkiewicz on December 06, 2023, 06:56:35 AMthe processing is delegated to the function defined in the program

More precisely, "delegated" means that in the invisible internal WndProc you would find at the very beginning an
invoke UserDefinedDlgProc, hWnd, uMsg, wParam, lParam
That proc (your proc) is not supposed to call DefDlgProc or DefWindowProc; instead, it just returns FALSE (=do default processing) or TRUE (=user had a handler, don't process).

For a few messages where returning something concrete (e.g. a brush handle) makes sense, you can do that with an invoke SetWindowLong, hwndDlg, DWL_MSGRESULT, hBrush immediately before returning TRUE.