]> git.saurik.com Git - wxWidgets.git/blob - docs/latex/wx/process.tex
fixed bug in mouse handling
[wxWidgets.git] / docs / latex / wx / process.tex
1 \section{\class{wxProcess}}\label{wxprocess}
2
3 The objects of this class are used in conjunction with
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).
16
17 wxProcess also supports IO redirection of the child process. For this, you have
18 to call its \helpref{Redirect}{wxprocessredirect} method before passing it to
19 \helpref{wxExecute}{wxexecute}. If the child process was launched successfully,
20 \helpref{GetInputStream}{wxprocessgetinputstream},
21 \helpref{GetOutputStream}{wxprocessgetoutputstream} and
22 \helpref{GetErrorStream}{wxprocessgeterrorstream} can then be used to retrieve
23 the streams corresponding to the child process stdandard output, input and
24 error output respectively.
25
26 \wxheading{Derived from}
27
28 \helpref{wxEvtHandler}{wxevthandler}
29
30 \wxheading{Include files}
31
32 <wx/process.h>
33
34 \wxheading{See also}
35
36 \helpref{wxExecute}{wxexecute}\\
37 \helpref{exec sample}{sampleexec}
38
39 \latexignore{\rtfignore{\wxheading{Members}}}
40
41 \membersection{wxProcess::wxProcess}\label{wxprocessconstr}
42
43 \func{}{wxProcess}{\param{wxEvtHandler *}{ parent = NULL}, \param{int}{ id = -1}}
44
45 Constructs a process object. {\it id} is only used in the case you want to
46 use wxWindows events. It identifies this object, or another window that will
47 receive the event.
48
49 If the {\it parent} parameter is different from NULL, it will receive
50 a wxEVT\_END\_PROCESS notification event (you should insert EVT\_END\_PROCESS
51 macro in the event table of the parent to handle it) with the given {\it id}.
52
53 \wxheading{Parameters}
54
55 \docparam{parent}{The event handler parent.}
56
57 \docparam{id}{id of an event.}
58
59 \membersection{wxProcess::\destruct{wxProcess}}
60
61 \func{}{\destruct{wxProcess}}{\void}
62
63 Destroys the wxProcess object.
64
65 \membersection{wxProcess::CloseOutput}\label{wxprocesscloseoutput}
66
67 \func{void}{CloseOutput}{\void}
68
69 Closes the output stream (the one connected to the stdin of the child
70 process). This function can be used to indicate to the child process that
71 there is no more data to be read - usually, a filter program will only
72 terminate when the input stream is closed.
73
74 \membersection{wxProcess::Detach}\label{wxprocessdetach}
75
76 \func{void}{Detach}{\void}
77
78 Normally, a wxProcess object is deleted by its parent when it receives the
79 notification about the process termination. However, it might happen that the
80 parent object is destroyed before the external process is terminated (e.g. a
81 window from which this external process was launched is closed by the user)
82 and in this case it {\bf should not delete} the wxProcess object, but
83 {\bf should call Detach()} instead. After the wxProcess object is detached
84 from its parent, no notification events will be sent to the parent and the
85 object will delete itself upon reception of the process termination
86 notification.
87
88 \membersection{wxProcess::GetErrorStream}\label{wxprocessgeterrorstream}
89
90 \constfunc{wxInputStream* }{GetErrorStream}{\void}
91
92 Returns an input stream which corresponds to the standard error output (stderr)
93 of the child process.
94
95 \membersection{wxProcess::GetInputStream}\label{wxprocessgetinputstream}
96
97 \constfunc{wxInputStream* }{GetInputStream}{\void}
98
99 It returns a output stream corresponding to the standard output stream of the
100 subprocess. If it is NULL, you have not turned on the redirection.
101 See \helpref{wxProcess::Redirect}{wxprocessredirect}.
102
103 \membersection{wxProcess::GetOutputStream}\label{wxprocessgetoutputstream}
104
105 \constfunc{wxOutputStream* }{GetOutputStream}{\void}
106
107 It returns an output stream correspoding to the input stream of the subprocess.
108 If it is NULL, you have not turned on the redirection.
109 See \helpref{wxProcess::Redirect}{wxprocessredirect}.
110
111 \membersection{wxProcess::OnTerminate}\label{wxprocessonterminate}
112
113 \constfunc{void}{OnTerminate}{\param{int}{ pid}, \param{int}{ status}}
114
115 It is called when the process with the pid {\it pid} finishes.
116 It raises a wxWindows event when it isn't overridden.
117
118 \docparam{pid}{The pid of the process which has just terminated.}
119
120 \docparam{status}{The exit code of the process.}
121
122 \membersection{wxProcess::Redirect}\label{wxprocessredirect}
123
124 \func{void}{Redirect}{\void}
125
126 It turns on the redirection, wxExecute will try to open a couple of pipes
127 to catch the subprocess stdio. The caught input stream is returned by
128 GetOutputStream() as a non-seekable stream. The caught output stream is returned
129 by GetInputStream() as a non-seekable stream.
130