The objects of this class are used in conjonction with wxExecute function. When a wxProcess object is passed to wxExecute(), its OnTerminate() virtual method is called when the process terminates. This allows the program to be (asynchronously) notified about the process termination and also retrieve its exit status which is unavailable from wxExecute() in the case of asynchronous execution.
Please note that if the process termination notification is processed by the parent, it is responsible for deleting the wxProcess object which sent it. However, if it is not processed, the object will delete itself and so the library users should only delete those objects whose notifications have been processed (and call Detach() for others).
Derived from
Include files
<wx/process.h>
Members
wxProcess::wxProcess
wxProcess::~wxProcess
wxProcess::Detach
wxProcess::OnTerminate
wxProcess(wxEvtHandler * parent = NULL, int id = -1)
Constructs a process object. id is only used in the case you want to use wxWindows events. It identifies this object, or another window that will receive the event.
If the parent parameter is different from NULL, it will receive a wxEVT_END_PROCESS notification event (you should insert EVT_END_PROCESS macro in the event table of the parent to handle it) with the given id.
Parameters
parent
id
~wxProcess()
Destroys the wxProcess object.
void Detach()
Normally, a wxProcess object is deleted by its parent when it receives the notification about the process termination. However, it might happen that the parent object is destroyed before the external process is terminated (e.g. a window from which this external process was launched is closed by the user) and in this case it should not delete the wxProcess object, but should call Detach() instead. After the wxProcess object is detached from its parent, no notification events will be sent to the parent and the object will delete itself upon reception of the process termination notification.
void OnTerminate(int pid, int status) const
It is called when the process with the pid pid finishes. It raises a wxWindows event when it isn't overriden.
pid
status