TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Ivan Joergensen
from: Dan Larson
date: 1995-01-25 05:04:58
subject: APPLICATION/WINDOW TERMIN

IJ>How do I detect that the user has selected to shut down OS/2 ?

IJ>I am a little confused on this subject. Suppose that the window is
IJ>some sort of an editor. When the user wants to close the window the
IJ>window should ask the user if he wants to save the changes (if any).
IJ>But what if the user is shutting down OS/2 ? In that case the window
IJ>should not ask any questions, but rather save changes automatically
IJ>(eventually to a special file, which is reloaded the next time the
IJ>user starts the program).

IJ>I have locked at WM_CLOSE, WM_DESTROY and WM_SAVEAPPLICATION, but none
IJ>of the messages seem to be the "correct" one to detect a shutdown.

WM_SAVEAPPLICATION will do the trick, but you should post a WM_QUIT to yourself
after you are finished processing it.  When you get a WM_SAVEAPPLICATION, close
all of your files and shut down you program. Then post a WM_QUIT to yourself.

You do not want to handle the WM_SAVEAPPLICATION the same way you'd handle a
WM_CLOSE.  Traditionally you might respond to a WM_CLOSE with an "Are you Sure?

message box.  When you get a WM_SAVEAPPLICATION just shut the program straight
down.


___
 * MR/2 1.52 NR * MS Windows : XT power for your 386/486 machine!

--- WILDMAIL!/WC v4.11 
* Origin: Freezing Point BBS - WDNet HQ - Mpls MN: (1:282/85.0)
SEEN-BY: 12/2442 620/243 624/50 632/348 640/820 690/660 711/409 410 413 430
SEEN-BY: 711/807 808 809 934 942 949 955 712/515 713/888 800/1 7877/2809
@PATH: 282/85 1 270/101 396/1 3615/50 105/103 42 724/13 600/500 2 82 229/2
@PATH: 12/2442 711/409 808 809 934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.