Nebula
Loading...
Searching...
No Matches
win32process.h
Go to the documentation of this file.
1#pragma once
2//------------------------------------------------------------------------------
12#include "util/string.h"
13#include "io/uri.h"
14#include "io/stream.h"
16
17//------------------------------------------------------------------------------
18namespace Win32
19{
21{
22public:
23
26
28 bool LaunchWait() const;
30 bool Launch();
32 bool IsRunning();
34 void UpdateStdoutStream();
36 bool CheckIfExists();
38 static bool CheckIfExists(const IO::URI & program);
39
40private:
42 bool LaunchWithoutOutputCapturing(DWORD creationFlags, const Util::String& cmdLine) const;
44 bool LaunchWithOutputCapturing(DWORD creationFlags, const Util::String& cmdLine) const;
46 bool CreateStdoutCapturePipe(PHANDLE stdoutRead, PHANDLE stdoutWrite) const;
48 void CaptureOutput(HANDLE stdoutRead, HANDLE stderrRead, HANDLE childProcess) const;
49
50 PROCESS_INFORMATION lauchedProcessInfo;
55
58 static const int asyncBufferSize = 4096;
60
61};
62
63} // namespace Win32
64//------------------------------------------------------------------------------
Base class for launching an external application.
Definition processbase.h:19
An URI object can split a Uniform Resource Identifier string into its components or build a string fr...
Definition uri.h:67
Definition win32process.h:21
bool CreateStdoutCapturePipe(PHANDLE stdoutRead, PHANDLE stdoutWrite) const
create pipe for optional stdout capturing
Definition win32process.cc:418
bool LaunchWithOutputCapturing(DWORD creationFlags, const Util::String &cmdLine) const
launch with stdout capturing
Definition win32process.cc:301
bool LaunchWithoutOutputCapturing(DWORD creationFlags, const Util::String &cmdLine) const
launch without stdout capturing
Definition win32process.cc:268
void CaptureOutput(HANDLE stdoutRead, HANDLE stderrRead, HANDLE childProcess) const
capture data from output
Definition win32process.cc:441
char asyncBuffer[asyncBufferSize]
Definition win32process.h:59
HANDLE stdoutAsyncRead
Definition win32process.h:51
DWORD numAsyncBytesAvailable
Definition win32process.h:57
void UpdateStdoutStream()
Read data from the captured stdout and writes it to the stream.
Definition win32process.cc:202
bool CheckIfExists()
Detect if an instance of the process is already running.
Definition win32process.cc:515
bool IsRunning()
Gets the state of application. Call this per frame.
Definition win32process.cc:164
HANDLE stderrAsyncRead
Definition win32process.h:53
bool Launch()
launch application (returns immediately)
Definition win32process.cc:59
bool LaunchWait() const
launch application and wait for its termination
Definition win32process.cc:28
static const int asyncBufferSize
Definition win32process.h:58
HANDLE stdoutAsyncWrite
Definition win32process.h:52
DWORD numAsyncBytesRead
Definition win32process.h:56
Win32Process()
constructor
Definition win32process.cc:18
PROCESS_INFORMATION lauchedProcessInfo
Definition win32process.h:50
HANDLE stderrAsyncWrite
Definition win32process.h:54
[TODO: Describe Win32 subsystem]
Nebula's universal string class.
Definition string.h:50