lecui 1.0.0-alpha.20
lecui C++ user interface library
Public Member Functions | List of all members
liblec::lecui::instance_manager Class Reference

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...
 

Detailed Description

Manage application instances.

Constructor & Destructor Documentation

◆ instance_manager()

liblec::lecui::instance_manager::instance_manager ( form fm,
const std::string &  guid 
)

Class constructor.

Parameters
fmA reference to the form.
guidUnique 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.

Member Function Documentation

◆ send_data()

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.

Parameters
guidThe unique guid of the target application.
dataThe data to send.
timeout_millisecondsThe timeout of the send operation, in milliseconds.
errorError information.
Returns
Returns true if the operation is successful, else false.

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