Nebula
Loading...
Searching...
No Matches
Win32::Win32Process Class Reference

#include <win32process.h>

Inherits Base::Process.

Public Member Functions

 Win32Process ()
 constructor
 
bool LaunchWait () const
 launch application and wait for its termination
 
bool Launch ()
 launch application (returns immediately)
 
bool IsRunning ()
 Gets the state of application. Call this per frame.
 
void UpdateStdoutStream ()
 Read data from the captured stdout and writes it to the stream.
 
bool CheckIfExists ()
 Detect if an instance of the process is already running.
 
- Public Member Functions inherited from Base::Process
 Process ()
 constructor
 
void SetExecutable (const IO::URI &uri)
 set the executable path
 
void SetWorkingDirectory (const IO::URI &uri)
 set working directory
 
void SetArguments (const Util::String &args)
 set command line arguments
 
void SetNoConsoleWindow (bool b)
 do not open a console window for the new process
 
void SetStdoutCaptureStream (const Ptr< IO::Stream > &stream)
 set optional stdout capture stream
 
const Ptr< IO::Stream > & GetStdoutCaptureStream () const
 get optional pointer to stdout capture stream
 
void SetStderrCaptureStream (const Ptr< IO::Stream > &stream)
 set optional stderr capture stream
 
const Ptr< IO::Stream > & GetStderrCaptureStream () const
 get optional pointer to stderr capture stream
 

Static Public Member Functions

static bool CheckIfExists (const IO::URI &program)
 Detect if an instance of a given process is running.
 

Private Member Functions

bool LaunchWithoutOutputCapturing (DWORD creationFlags, const Util::String &cmdLine) const
 launch without stdout capturing
 
bool LaunchWithOutputCapturing (DWORD creationFlags, const Util::String &cmdLine) const
 launch with stdout capturing
 
bool CreateStdoutCapturePipe (PHANDLE stdoutRead, PHANDLE stdoutWrite) const
 create pipe for optional stdout capturing
 
void CaptureOutput (HANDLE stdoutRead, HANDLE stderrRead, HANDLE childProcess) const
 capture data from output
 

Private Attributes

PROCESS_INFORMATION lauchedProcessInfo
 
HANDLE stdoutAsyncRead
 
HANDLE stdoutAsyncWrite
 
HANDLE stderrAsyncRead
 
HANDLE stderrAsyncWrite
 
DWORD numAsyncBytesRead
 
DWORD numAsyncBytesAvailable
 
char asyncBuffer [asyncBufferSize]
 

Static Private Attributes

static const int asyncBufferSize = 4096
 

Additional Inherited Members

- Protected Attributes inherited from Base::Process
bool noConsoleWindow
 
bool isRunning
 
IO::URI exePath
 
IO::URI workingDir
 
Util::String args
 
Ptr< IO::StreamstdoutCaptureStream
 
Ptr< IO::StreamstderrCaptureStream
 

Constructor & Destructor Documentation

◆ Win32Process()

Win32::Win32Process::Win32Process ( )

constructor

Member Function Documentation

◆ CaptureOutput()

void Win32::Win32Process::CaptureOutput ( HANDLE stdoutRead,
HANDLE stderrRead,
HANDLE childProcess ) const
private

capture data from output

◆ CheckIfExists() [1/2]

bool Win32::Win32Process::CheckIfExists ( )
virtual

Detect if an instance of the process is already running.

Implements Base::Process.

◆ CheckIfExists() [2/2]

bool Win32::Win32Process::CheckIfExists ( const IO::URI & program)
static

Detect if an instance of a given process is running.

◆ CreateStdoutCapturePipe()

bool Win32::Win32Process::CreateStdoutCapturePipe ( PHANDLE stdoutRead,
PHANDLE stdoutWrite ) const
private

create pipe for optional stdout capturing

◆ IsRunning()

bool Win32::Win32Process::IsRunning ( )
virtual

Gets the state of application. Call this per frame.

Gets the state of the application.

Implements Base::Process.

◆ Launch()

bool Win32::Win32Process::Launch ( )
virtual

launch application (returns immediately)

Launch the application process and returns immediately.

The state of the launched process can be checked by calling IsRunning().

Implements Base::Process.

◆ LaunchWait()

bool Win32::Win32Process::LaunchWait ( ) const
virtual

launch application and wait for its termination

Implements Base::Process.

◆ LaunchWithoutOutputCapturing()

bool Win32::Win32Process::LaunchWithoutOutputCapturing ( DWORD creationFlags,
const Util::String & cmdLine ) const
private

launch without stdout capturing

◆ LaunchWithOutputCapturing()

bool Win32::Win32Process::LaunchWithOutputCapturing ( DWORD creationFlags,
const Util::String & cmdLine ) const
private

launch with stdout capturing

◆ UpdateStdoutStream()

void Win32::Win32Process::UpdateStdoutStream ( )
virtual

Read data from the captured stdout and writes it to the stream.

Reads all arrived data from stdout since the last call of this method and puts it to the stream.

Implements Base::Process.

Member Data Documentation

◆ asyncBuffer

char Win32::Win32Process::asyncBuffer[asyncBufferSize]
private

◆ asyncBufferSize

const int Win32::Win32Process::asyncBufferSize = 4096
staticprivate

◆ lauchedProcessInfo

PROCESS_INFORMATION Win32::Win32Process::lauchedProcessInfo
private

◆ numAsyncBytesAvailable

DWORD Win32::Win32Process::numAsyncBytesAvailable
private

◆ numAsyncBytesRead

DWORD Win32::Win32Process::numAsyncBytesRead
private

◆ stderrAsyncRead

HANDLE Win32::Win32Process::stderrAsyncRead
private

◆ stderrAsyncWrite

HANDLE Win32::Win32Process::stderrAsyncWrite
private

◆ stdoutAsyncRead

HANDLE Win32::Win32Process::stdoutAsyncRead
private

◆ stdoutAsyncWrite

HANDLE Win32::Win32Process::stdoutAsyncWrite
private

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