en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en it en en en en nl en en en en en en en en en en en it en en en en de fr en en en en nl en en en en en en en en en en en en en en nl en en en en en en en en en en en en fr en en en en en en en en nl en en en en en tr en en fr en en en en en en en it en en en en nl en en en en en en en it en en en en en en it en en en en nl en en en en en en it en en en en en en it en en en en nl vi en en en en en en en en it en en en en en en en en de en en en fr en en en en en en en en en pt en en en en en en
By logging into your account, you agree to our Privacy Policy, personal data processing and storage practices as described therein.
Forgot password or user name?
Search in titles only Search in PowerBASIC for Windows only
You are not logged in. You can browse in the PowerBASIC Community, but you must click Login (top right) before you can post. If this is your first visit, check out the FAQ or Sign Up.
All Time Today Last Week Last Month
All Discussions only Photos only Videos only Links only Polls only Events only
I know we've covered this for evasive action before but lets say I have an option in my app to save settings prior to closing.
If someone closes the app via the X on the top right, or Windodws is shutting down, do I use WM_QUERYENDSESSION or WM_CLOSE to detect this and save my settings first?
True Karate-do is this: that in daily life, one's mind and body be trained and developed in a spirit of humility; and that in critical times, one be devoted utterly to the cause of justice. -Gichin Funakoshi
Join Date: Jun 2003
15 Feb 2001, 10:55 AM
I,m using %WM_SYSCOMMAND, work fine for me on close or ALT-F4....
Case %WM_SYSCOMMAND If CbWparam = %SC_CLOSE Then 'Alt-F4 not allowed! ' Do whatever you want to do........ End If 'dialog.
mailto [email protected][email protected]
15 Feb 2001, 11:08 AM
When the X is clicked, or the program icon is clicked and you
select close or just alt+F4, windows sends the WM_SYSCOMMAND to
to the top level window. Just let the default procedure handle
this and a WM_CLOSE is issued back to the window.
When Windows is shutting down, the WM_QUERYENDSESSION is sent
to all top level windows that are running. Just make a procedure
that you call from the window procedure at these two messages
to do your program saves.
Join Date: Oct 1987
15 Feb 2001, 12:30 PM
It's a very good idea to "respond" to a WM_QUERYENDSESSION as quickly as possible, and then begin your shutdown process. By returning 1 your application is telling Windows "I promise to shut down". If you don't return 1 within the Windows timeout, Windows will terminate your application "without mercy".
In other words, you should do something like this:
ELSEIF wMsg = %WM_QUERYENDSESSION THEN PostQuitMessage 0 FUNCTION = 1
Then when your app processes the WM_QUIT that is posted by PostQuitMessage, it should shut down as quickly as possible.
(You don't have to use WM_QUIT... You could use SendMessage %WM_USER, for example.)
Perfect Sync: Perfect Sync Development Tools
Email: mailto:[email protected][email protected]
[This message has been edited by Eric Pearson (edited February 15, 2001).]
"Not my circus, not my monkeys."
Join Date: Aug 1998
15 Feb 2001, 12:38 PM
I See two issues here.
I don't want to repeat my %IDM_EXIT menu function in the event of SC_CLOSE Or WM_CLOSE (Whats' the difference?)..
So if I send a Control send cbhndl,%IDM_EXIT,%BM_CLICK,0,0 it occurs twice upon a N ORMAL ueage of %IDM_EXIT.
How do I avoid that now?
[This message has been edited by Scott Turchin (edited February 15, 2001).]
True Karate-do is this: that in daily life, one's mind and body be trained and developed in a spirit of humility; and that in critical times, one be devoted utterly to the cause of justice. -Gichin Funakoshi
Join Date: Aug 1998
15 Feb 2001, 12:46 PM
Think I got it, thank god for the Win32api bible
WM_CLOSE is alt-f4, SC_CLOSE is the SYSTEM COMMAND Of CLOSE, and QUERYENDSESSION is ONLY when a user is logging off the machine.
[This message has been edited by Scott Turchin (edited February 15, 2001).]
True Karate-do is this: that in daily life, one's mind and body be trained and developed in a spirit of humility; and that in critical times, one be devoted utterly to the cause of justice. -Gichin Funakoshi
Join Date: Aug 1998
15 Feb 2001, 12:57 PM
Yup got it! This works flawlessly and I just did a reboot to test it!
%IDM_EXIT does the file saving, user will get prompted (UNless he turned that option of hehe)
Select case CbMsg Case %WM_QUERYENDSESSION',%WM_CLOSE Control Send CbHndl, %IDM_EXIT,%BM_CLICK,0,0 PostQuitMessage 0 Function = %TRUE Case %WM_SYSCOMMAND Select Case CbWparam Case %SC_CLOSE 'SYSTSEM CLOSE Control Send CbHndl, %IDM_EXIT,%BM_CLICK,0,0 End Select
True Karate-do is this: that in daily life, one's mind and body be trained and developed in a spirit of humility; and that in critical times, one be devoted utterly to the cause of justice. -Gichin Funakoshi
Copyright © 1998-2022 PowerBASIC Tools, LLC - All Rights Reserved.
Powered by vBulletin® Version 5.7.0
Copyright © 2022 vBulletin Solutions, Inc. All rights reserved.
All times are GMT-5. This page was generated at 01:47 AM.
We process personal data about users of our site, through the use of cookies and other technologies, to deliver our services, and to analyze site activity. For additional details, refer to our Privacy Policy.
By clicking "I AGREE" below, you agree to our Privacy Policy and our personal data processing and cookie practices as described therein. You also acknowledge that this forum may be hosted outside your country and you consent to the collection, storage, and processing of your data in the country where this forum is hosted.