Article View: comp.os.ms-windows.programmer.misc
Article #2563Re: Passing information from dialogs ?
From: Tom W. Brown
Date: Thu, 07 Jan 1993 20:03
Date: Thu, 07 Jan 1993 20:03
35 lines
2241 bytes
2241 bytes
In article <1ihdmfINNnnt@sauna.cs.hut.fi>, s34090e@kaira.hut.fi (Petri Taavila) writes: |> What is the "best" way to pass information from modal |> dialogbox to its parent window if there are many |> different controls in the dialogbox? 1. If the parent window only needs to know which button (e.g. OK or Cancel) was pressed then you can do this with the return value from the call to DialogBox() -- this return value is the second parameter supplied to the EndDialog() call. The assumption here is that the other controls in the dialog box are used to adjust global variables that both the dialog box procedure and the parent window code have access to. 2. You can pass a pointer to a block of memory as the last parameter in the call to DialogBoxParam(). The dialog box procedure should store this in a static variable during WM_INITDIALOG processing so that it can access it during subsequent messages. This block of memory then contains the flags and other assorted data that map onto the dialog box controls. The dialog box adjusts the data as necessary and when control is returned to the parent window it can read the data to see what happened. I find myself doing it either way -- it depends on how much you dislike using global variables. If I stretch my imagination I'm sure that I could come up with some more esoteric ways of doing this, but these two are going to be the most common. ---------------------------------------------------------------------------- Tom Brown | "She turned me into a newt... PE Nelson Systems | ... I got better" twbrown@pe-nelson.com | Monty Python and the Holy Grail ----------------------------------------------------------------------------
Technical Details
Message-ID:
<730@lax.lax.pe-nelson.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!lax.pe-nelson.com!lax!twbrownReferences:
<1ihdmfINNnnt@sauna.cs.hut.fi>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!lax.pe-nelson.com!lax!twbrown From: twbrown@PE-Nelson.COM (Tom W. Brown) Newsgroups: comp.os.ms-windows.programmer.misc Subject: Re: Passing information from dialogs ? Message-ID: <730@lax.lax.pe-nelson.com> Date: 7 Jan 93 20:03:09 GMT References: <1ihdmfINNnnt@sauna.cs.hut.fi> Sender: news@lax.pe-nelson.com Distribution: inet Organization: PE-Nelson Lines: 35