home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / os / mswindo / programm / misc / 4704 < prev    next >
Encoding:
Internet Message Format  |  1993-01-07  |  2.1 KB

  1. Path: sparky!uunet!lax.pe-nelson.com!lax!twbrown
  2. From: twbrown@PE-Nelson.COM (Tom W. Brown)
  3. Newsgroups: comp.os.ms-windows.programmer.misc
  4. Subject: Re: Passing information from dialogs ?
  5. Message-ID: <730@lax.lax.pe-nelson.com>
  6. Date: 7 Jan 93 20:03:09 GMT
  7. References: <1ihdmfINNnnt@sauna.cs.hut.fi>
  8. Sender: news@lax.pe-nelson.com
  9. Distribution: inet
  10. Organization: PE-Nelson
  11. Lines: 35
  12.  
  13. In article <1ihdmfINNnnt@sauna.cs.hut.fi>, s34090e@kaira.hut.fi (Petri Taavila) writes:
  14. |> What is the "best" way to pass information from modal
  15. |> dialogbox to its parent window if there are many
  16. |> different controls in the dialogbox?
  17.  
  18. 1. If the parent window only needs to know which button (e.g. OK or Cancel)
  19.    was pressed then you can do this with the return value from the call
  20.    to DialogBox() -- this return value is the second parameter supplied to
  21.    the EndDialog() call.
  22.  
  23.    The assumption here is that the other controls in the dialog box are
  24.    used to adjust global variables that both the dialog box procedure and
  25.    the parent window code have access to.
  26.  
  27. 2. You can pass a pointer to a block of memory as the last parameter in
  28.    the call to DialogBoxParam().  The dialog box procedure should store this
  29.    in a static variable during WM_INITDIALOG processing so that it can
  30.    access it during subsequent messages.
  31.  
  32.    This block of memory then contains the flags and other assorted data
  33.    that map onto the dialog box controls.  The dialog box adjusts the data
  34.    as necessary and when control is returned to the parent window it can
  35.    read the data to see what happened.
  36.  
  37. I find myself doing it either way -- it depends on how much you dislike
  38. using global variables.  If I stretch my imagination I'm sure that I could
  39. come up with some more esoteric ways of doing this, but these two are going
  40. to be the most common.
  41.  
  42.  
  43. ----------------------------------------------------------------------------
  44. Tom Brown               |  "She turned me into a newt...
  45. PE Nelson Systems       |                                  ... I got better"
  46. twbrown@pe-nelson.com   |                    Monty Python and the Holy Grail
  47. ----------------------------------------------------------------------------
  48.