Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- The Guide to Clip-4-Win version 3.0 - http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
  
  Dialog resources are accessed in two ways, depending on
  whether you want a modal dialog or a modeless dialog.  The
  most common by far are modal dialogs, which are accessed using
  the DialogBox() function, and terminated by EndDialog().
  Modeless dialog resources are accessed by CreateDialog(), and
  terminated by DestroyWindow().  Note that CreateDialog() is
  also used to create dynamic dialogs; there is no confusion, as
  the parameters are so different.
  
  For dialog resources, both DialogBox() and CreateDialog()
  have as their fourth parameter a code block, which receives
  messages sent by Windows as the dialog is created, used, and
  terminated.
  
  Example:
  
       nRet = DialogBox( , "mydialog",  ,                             ;
                        { | hDlg, nMsg, nwParam, nlParam |            ;
                          DlgFunc( hDlg, nMsg, nwParam, nlParam ) } )
  
  (Note: this example uses the default instance handle and
  parent window.)
  
  As you can see, these messages from Windows have 4 parameters:
  
            hDlg      the handle of the dialog window
            nMsg      the WM_* value identifying the message
            nwParam   depends on nMsg
            nlParam   depends on nMsg
  
  The code block should return a value to indicate whether it
  processed the message.  In practice, you'll probably just call
  a function (as shown above), so it's up to the function to
  behave correctly.
  
  Most of the messages can be ignored, in which case the dialog
  function should return zero (0).  However, the WM_INITDIALOG
  message, which is sent before the dialog is made visible, is
  different: you should only return zero if you use SetFocus()
  to give the input focus to a particular control within the
  dialog.  You should return a non-zero value (one (1) is
  usually used) if you don't set the focus, in which case the
  focus will be set by default (typically to the first control
  with the WS_TABSTOP setting).  For this message, nwParam is
  the handle of the control that will be given the focus by
  default.
  
  The other important message is WM_COMMAND, which is sent when
  a control sends a notification message to its parent.
  Examples of controls are buttons, list boxes, edit controls
  and combo boxes.  The parent will be the dialog box itself
  (identified by hDlg).
  
  The numeric id of the control is passed in the nwParam
  parameter.
  
  The nlParam value is really two values joined together.  These
  may be fetched using _LastLolParam(), which identifies the
  handle of the control, and _LastHilParam(), which identifies
  the notification code the control is sending (one of the BN_*,
  CBN_*, EN_*, LBN_* values).  Alternatively, you can isolate
  these values using C4W_LOWORD( nlParam ) and C4W_HIWORD( nlParam ).
  
  During the processing of a dialog message, you may want to
  examine or change the contents or settings of the controls, or
  interact with them in other ways (e.g. enable/disable them).
  There are quite a few functions to help, such as:
  CheckDlgButton(), CheckRadioButton(), EnableWindow(),
  GetDialogBaseUnits(), GetDlgCtrlID(), GetDlgItem(),
  IsDlgButtonChecked(), MapDialogRect(), SendDlgItemMessage(),
  SendMessage(), and SetDlgItem().
  
  Remember, a dialog is just a particular style of window, with
  some default code to handle events within it, so you can use
  SendDlgItemMessage() or SendMessage() to interact with the
  controls inside the dialog.  Thus, edit controls can be sent
  EM_* messages, combo boxes can be sent CB_* messages, and so
  on.  See edit.prg and combobox.prg for some ideas.
  
  Note: often it's possible to use a dialog resource in a
  dynamic way, because you can re-arrange controls during
  WM_INITDIALOG processing, and enable/disable them, using
  EnableWindow().  You can move unwanted ones outside the
  dialog (so they can't be seen) - it's a good idea to disable
  them if you do this!  The source\dialog.prg file shows some of
  the things that are possible (re-arranging controls, and
  drawing in the dialog).
  
  

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson