Article View: comp.os.ms-windows.programmer.misc
Article #1664Re: how are IDCANCEL, WM_SYSCOMMAND/SC_CLOSE & WM_DESTROY related?
From: Tom W. Brown
Date: Fri, 16 Oct 1992 21:00
Date: Fri, 16 Oct 1992 21:00
34 lines
2463 bytes
2463 bytes
In article <1992Oct15.233010.26926@emr1.emr.ca>, jagrant@emr1.emr.ca (John Grant) writes: |> I have about a dozen dialog boxes and I want to be able to double click the |> handle in the upper left or use ALT-F4 to close them. All of the dialog |> box procs call EndDialog upon receiving WM_DESTROY (that is correct, isn't it?) |> Not all dialog boxes have both CANCEL & OK buttons - some have only OK buttons. |> |> I have found that if the box has both OK & CANCEL, the double click or ALT-F4 |> action sends a WM_DESTROY and all is ok. However, if the box has no CANCEL |> button, nothing happens - all of the following fail: |> (a) double click on system menu |> (b) click system menu & 'close window' |> (c) alt-F4 |> In these cases, I have to intercept WM_SYSCOMMAND, wparam==SC_CLOSE and then |> send myself a WM_DESTROY message. |> |> Why does this happen? Obviously, it is translating the action to WM_DESTROY |> but only if there is a CANCEL button. Where is this being done. Can anyone |> point me to the documentation for this behaviour. Is my solution of processing |> WM_SYSCOMMAND/SC_CLOSE & sending WM_DESTROY correct? Are you sure that using the system menu to close a dialog sends a WM_DESTROY or calls EndDialog? I always thought it simply did a WM_COMMAND/IDCANCEL. At least my IDCANCEL handler will be invoked when I close a dialog box this way. Try adding IDCANCEL to the WM_COMMAND handler for your dialog even though you have no cancel button. Do an EndDialog here. Maybe this will work. ---------------------------------------------------------------------------- Tom Brown | "Strange women, lying in ponds, distributing PE Nelson Systems | swords is no basis for a system of government." twbrown@pe-nelson.com | Monty Python and the Holy Grail ----------------------------------------------------------------------------
Technical Details
Message-ID:
<639@lax.lax.pe-nelson.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!lax.pe-nelson.com!lax!twbrownReferences:
<36560011@hpgrla.gr.hp.com> <1992Oct15.202628.13352@javelin.sim.es.com> <1992Oct15.232242.26579@emr1.emr.ca> <1992Oct15.233010.26926@emr1.emr.ca>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: how are IDCANCEL, WM_SYSCOMMAND/SC_CLOSE & WM_DESTROY related? Message-ID: <639@lax.lax.pe-nelson.com> Date: 16 Oct 92 21:00:53 GMT References: <36560011@hpgrla.gr.hp.com> <1992Oct15.202628.13352@javelin.sim.es.com> <1992Oct15.232242.26579@emr1.emr.ca> <1992Oct15.233010.26926@emr1.emr.ca> Sender: news@lax.pe-nelson.com Organization: PE-Nelson Lines: 34