lecui 1.0.0-alpha.20
lecui C++ user interface library
|
Manage application instances. More...
#include <instance.h>
Public Member Functions | |
instance_manager (form &fm, const std::string &guid) | |
Class constructor. More... | |
~instance_manager () | |
Class destructor. | |
bool | send_data (const std::string &guid, const std::string &data, const long &timeout_milliseconds, std::string &error) |
Send data to another application instance. More... | |
Manage application instances.
liblec::lecui::instance_manager::instance_manager | ( | form & | fm, |
const std::string & | guid | ||
) |
Class constructor.
fm | A reference to the form. |
guid | Unique guid used to prevent multiple instances of the app, e.g. "Global\\{7DBACCA2-B96E-4D0E-B0F7-933EA9A3C064}". This same guid is also used to allow a new instance to (1) Cause a new instance to find and open the existing instance before exiting (2) Pass it's command line arguments as data to the existing instance. The latter is received in the existing instance through the form's receive_data event. |
It is highly recommended that top level forms within the same app use the same guid. This way, when a new instance is attempted, the latest form to be created will be brought to the foreground. GUIDs only apply to top level forms.
bool liblec::lecui::instance_manager::send_data | ( | const std::string & | guid, |
const std::string & | data, | ||
const long & | timeout_milliseconds, | ||
std::string & | error | ||
) |
Send data to another application instance.
guid | The unique guid of the target application. |
data | The data to send. |
timeout_milliseconds | The timeout of the send operation, in milliseconds. |
error | Error information. |