xtd - Reference Guide  0.1.0
Modern c++17 framework to create console, gui and unit test applications on Windows, macOS and Linux.
xtd::forms::application Class Reference

Provides static methods and properties to manage an application, such as methods to start and stop an application, to process Windows messages, and methods to get information about an application. This class cannot be inherited. More...

#include <application.h>

Static Public Member Functions

static void add_message_filter (const imessage_filter &value)
 Adds a message filter to monitor Windows messages as they are routed to their destinations. More...
 
static bool allow_quit ()
 Gets a value indicating whether the caller can quit this application. More...
 
static std::string common_app_data_path ()
 Gets the path for the application data that is shared among all users. More...
 
static std::string company_name ()
 Gets the company name associated with the application. More...
 
static bool dark_mode_enabled ()
 Return true if dark mode is enabled for the application; otherwise return false. More...
 
static void do_events ()
 Processes all Windows messages currently in the message queue. More...
 
static void enable_button_images ()
 Enables button images for the application. More...
 
static void enable_dark_mode ()
 Enables dark mode for the application. More...
 
static void enable_light_mode ()
 Enables light mode for the application. More...
 
static void enable_menu_images ()
 Enables menu images for the application. More...
 
static void enable_visual_styles ()
 Enables visual styles for the application. More...
 
static std::string executable_name ()
 Gets the executable name for the executable file that started the application, including the executable extension. More...
 
static std::string executable_path ()
 Gets the path for the executable file that started the application, including the executable name. More...
 
static void exit ()
 Informs all message pumps that they must terminate, and then closes all application windows after the messages have been processed. More...
 
static void exit (cancel_event_args &e)
 Informs all message pumps that they must terminate, and then closes all application windows after the messages have been processed. More...
 
static void exit_thread ()
 Exits the message loop on the current thread and closes all windows on the thread. More...
 
static bool light_mode_enabled ()
 Return true if dark mode is enabled for the application; otherwise return false. More...
 
static bool message_loop ()
 Gets a value indicating whether a message loop exists on this thread. More...
 
static bool on_app_thread_exception ()
 
static void on_app_thread_exit (const application_context &sender, const event_args &e)
 
static const form_collection open_forms ()
 Gets a collection of open forms owned by the application. More...
 
static std::string product_name ()
 Gets the product name associated with this application. More...
 
static std::string product_version ()
 Gets the product version associated with this application. More...
 
static void raise_enter_thread_modal (const event_args &e)
 
static void raise_idle (const event_args &e)
 Raises the Idle event. More...
 
static void raise_leave_thread_modal (const event_args &e)
 
static std::string startup_path ()
 Gets the path for the executable file that started the application, not including the executable name. More...
 
static bool use_visual_styles ()
 Gets a value that indicates whether visual styles are enabled for the application. More...
 
static bool use_wait_cursor ()
 Gets whether the wait cursor is used for all open forms of the application. More...
 
static void use_wait_cursor (bool use_wait_cursor)
 Sets whether the wait cursor is used for all open forms of the application. More...
 
static std::string user_app_data_path ()
 Gets the path for the application data of a user. More...
 
static void wm_activate_app (message &message)
 
static void wm_enter_idle (message &message)
 
static void wm_quit (message &message)
 
static void wnd_proc (message &message)
 
static intptr_t wnd_proc_ (intptr_t hwnd, int32_t msg, intptr_t wparam, intptr_t lparam, intptr_t handle)
 

Static Public Attributes

static bool message_loop_
 
static bool use_visual_styles_
 
static bool use_wait_cursor_
 

Detailed Description

Provides static methods and properties to manage an application, such as methods to start and stop an application, to process Windows messages, and methods to get information about an application. This class cannot be inherited.

Remarks
The application class has methods to start and stop applications and threads, and to process Windows messages, as follows:
  • run() starts an application message loop on the current thread and, optionally, makes a form visible.
  • exit() or exit_thread() stops a message loop.
  • do_events() processes messages while your program is in a loop.
  • add_message_filter() adds a message filter to the application message pump to monitor Windows messages.
You cannot create an instance of this class.
Example
The following code example demonstrate the use of application class.
#include <xtd/xtd>
int main() {
xtd::forms::application::run(xtd::forms::form());
}

The documentation for this class was generated from the following file: