]>
Commit | Line | Data |
---|---|---|
eafc087e GL |
1 | \section{\class{wxProcess}}\label{wxprocess} |
2 | ||
8c517ddd | 3 | The objects of this class are used in conjunction with |
7e84f02d VZ |
4 | \helpref{wxExecute}{wxexecute} function. When a wxProcess object is passed to |
5 | wxExecute(), its \helpref{OnTerminate()}{wxprocessonterminate} virtual method | |
6 | is called when the process terminates. This allows the program to be | |
7 | (asynchronously) notified about the process termination and also retrieve its | |
8 | exit status which is unavailable from wxExecute() in the case of | |
9 | asynchronous execution. | |
10 | ||
11 | Please note that if the process termination notification is processed by the | |
12 | parent, it is responsible for deleting the wxProcess object which sent it. | |
13 | However, if it is not processed, the object will delete itself and so the | |
14 | library users should only delete those objects whose notifications have been | |
15 | processed (and call \helpref{Detach()}{wxprocessdetach} for others). | |
eafc087e GL |
16 | |
17 | \wxheading{Derived from} | |
18 | ||
19 | \helpref{wxEvtHandler}{wxevthandler} | |
20 | ||
954b8ae6 JS |
21 | \wxheading{Include files} |
22 | ||
23 | <wx/process.h> | |
24 | ||
eafc087e GL |
25 | \latexignore{\rtfignore{\wxheading{Members}}} |
26 | ||
27 | \membersection{wxProcess::wxProcess}\label{wxprocessconstr} | |
28 | ||
70dc22dc | 29 | \func{}{wxProcess}{\param{wxEvtHandler *}{ parent = NULL}, \param{bool}{ needPipe = FALSE}, \param{int}{ id = -1}} |
eafc087e GL |
30 | |
31 | Constructs a process object. {\it id} is only used in the case you want to | |
3972fb49 JS |
32 | use wxWindows events. It identifies this object, or another window that will |
33 | receive the event. | |
eafc087e | 34 | |
70dc22dc GL |
35 | If you set {\it needPipe} to TRUE, wxExecute will try to open a couple of pipes |
36 | to catch the subprocess stdio. The caught input stream is returned by | |
37 | GetOutputStream() as a non-seekable stream. The caught output stream is returned | |
38 | by GetInputStream() as a non-seekable stream. | |
39 | ||
7e84f02d VZ |
40 | If the {\it parent} parameter is different from NULL, it will receive |
41 | a wxEVT\_END\_PROCESS notification event (you should insert EVT\_END\_PROCESS | |
42 | macro in the event table of the parent to handle it) with the given {\it id}. | |
43 | ||
eafc087e GL |
44 | \wxheading{Parameters} |
45 | ||
46 | \docparam{parent}{The event handler parent.} | |
47 | ||
48 | \docparam{id}{id of an event.} | |
49 | ||
50 | \membersection{wxProcess::\destruct{wxProcess}} | |
51 | ||
52 | \func{}{\destruct{wxProcess}}{\void} | |
53 | ||
54 | Destroys the wxProcess object. | |
55 | ||
7e84f02d VZ |
56 | \membersection{wxProcess::Detach}\label{wxprocessdetach} |
57 | ||
58 | \func{void}{Detach}{\void} | |
59 | ||
60 | Normally, a wxProcess object is deleted by its parent when it receives the | |
61 | notification about the process termination. However, it might happen that the | |
62 | parent object is destroyed before the external process is terminated (e.g. a | |
63 | window from which this external process was launched is closed by the user) | |
64 | and in this case it {\bf should not delete} the wxProcess object, but | |
65 | {\bf should call Detach()} instead. After the wxProcess object is detached | |
66 | from its parent, no notification events will be sent to the parent and the | |
67 | object will delete itself upon reception of the process termination | |
68 | notification. | |
69 | ||
70dc22dc GL |
70 | \membersection{wxProcess::GetInputStream}\label{wxprocessgetinputstream} |
71 | ||
72 | \constfunc{wxInputStream* }{GetInputStream}{\void} | |
73 | ||
74 | It returns a input stream correspoding to the output stream of the subprocess. | |
75 | If it is NULL, you have not set needPipe to TRUE. | |
76 | ||
77 | \membersection{wxProcess::GetInputStream}\label{wxprocessgetinputstream} | |
78 | ||
79 | \constfunc{wxInputStream* }{GetInputStream}{\void} | |
80 | ||
81 | It returns a output stream corresponding to the input stream of the subprocess. | |
82 | If it is NULL, you have not set needPipe to TRUE. | |
83 | ||
eafc087e GL |
84 | \membersection{wxProcess::OnTerminate}\label{wxprocessonterminate} |
85 | ||
7e84f02d | 86 | \constfunc{void}{OnTerminate}{\param{int}{ pid}, \param{int}{ status}} |
eafc087e GL |
87 | |
88 | It is called when the process with the pid {\it pid} finishes. | |
89 | It raises a wxWindows event when it isn't overriden. | |
90 | ||
7e84f02d VZ |
91 | \docparam{pid}{The pid of the process which has just terminated.} |
92 | ||
93 | \docparam{status}{The exit code of the process.} | |
3972fb49 | 94 |