xtd 0.2.0
application_application_exit.cpp

Shows how to create an application with xtd::forms::application::application_exit event.

Windows

macOS

Gnome

#define TRACE
#include <xtd/diagnostics/trace>
#include <xtd/forms/application>
#include <xtd/environment>
using namespace xtd;
using namespace xtd::diagnostics;
using namespace xtd::forms;
auto main() -> int {
environment::program_exit += [] {trace::write_line("The program is stopped");};
application::application_exit += [] {trace::write_line("The application is stopped");};
trace::write_line("Before application run");
trace::write_line("After application exit");
trace::write_line("Before program exit");
}
// Trace
//
// Before application run
// The application is stopped
// After application exit
// Before program exit
// The program is stopped
static void write_line()
Writes a line terminator to the trace listeners in the listeners collection.
Definition trace.hpp:343
static event< environment, program_exit_event_handler > program_exit
Occurs when the terminates normally (via xtd::environment::exit or returning from the main function).
Definition environment.hpp:535
static void run()
Begins running a standard application message loop on the current thread, without a form.
static event< application, delegate< void(const event_args &)> > application_exit
Occurs when the application is about to shut down.
Definition application.hpp:318
Represents a window or dialog box that makes up an application's user interface.
Definition form.hpp:54
The xtd::diagnostics namespace provides classes that allow you to interact with system processes,...
Definition assert_dialog_result.hpp:10
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition texts.hpp:217
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8