Home » Community » Newbie corner » Ctrl::Quit() and system shutdown
Ctrl::Quit() and system shutdown [message #35558] |
Wed, 29 February 2012 11:06  |
jjacksonRIAB
Messages: 227 Registered: June 2011
|
Experienced Member |
|
|
How do I override a system shutdown to prompt a user, for example, to save their files?
Quit() does not seem to be called when I do a system shutdown, log off, or reboot on either Windows or Linux.
Just using modified example code:
#include <CtrlLib/CtrlLib.h>
using namespace Upp;
#define IMAGECLASS Tray
#define IMAGEFILE <TrayIcon/tray.iml>
#include <Draw/iml.h>
struct App : TrayIcon {
virtual void LeftDouble() {
Icon(Tray::Icon1());
PromptOK("TrayIcon launched this prompt!");
Icon(Tray::Icon());
}
virtual void Quit() {
PromptOK("Quitting...");
Break();
}
virtual void LeftDown() {
Info("TrayIcon", "You have clicked the TrayIcon!\n""TrayIcon is U++ reference example.");
}
virtual void Menu(Bar& bar) {
bar.Add("Info..", THISBACK(LeftDouble));
bar.Separator();
bar.Add("Exit", THISBACK(Quit));
}
typedef App CLASSNAME;
App() {
Icon(Tray::Icon());
Tip("This is U++ TrayIcon");
}
};
GUI_APP_MAIN
{
App().Run();
}
If I shutdown, the PromptOK window never shows, but it does show when I select Exit...
[Updated on: Wed, 29 February 2012 12:10] Report message to a moderator
|
|
|
|
|
Re: Ctrl::Quit() and system shutdown [message #35567 is a reply to message #35565] |
Wed, 29 February 2012 17:38  |
jjacksonRIAB
Messages: 227 Registered: June 2011
|
Experienced Member |
|
|
Ok I created a quick TopWindow-derived app and it does interrupt shutdown. TrayIcon does not receive that event.
I will embed the TrayIcon in a TopWindow control and that should take care of the problem. Thanks!
|
|
|
Goto Forum:
Current Time: Fri May 09 11:34:22 CEST 2025
Total time taken to generate the page: 0.00973 seconds
|