SystemProcessObjectInterface Class Reference

#include <system_process.h>

Inheritance diagram for SystemProcessObjectInterface:

Detailed Description

Public Member Functions

MAXON_METHOD Result< void > StartProcess ()
 
MAXON_METHOD Result< void > KillProcess ()
 
MAXON_METHOD Int GetExitCode () const
 
MAXON_METHOD Bool IsRunning () const
 
MAXON_METHOD UInt GetProcessId () const
 
MAXON_METHOD void * GetProcessHandle () const
 
MAXON_METHOD Url GetProcessUrl () const
 
MAXON_METHOD Url GetLogFile () const
 
MAXON_METHOD void * GetUserData () const
 
MAXON_METHOD Result< void > GetLoadedDlls (const ValueReceiver< const DllRef & > &dlls) const
 
 MAXON_OBSERVABLE (void, ObservableProcessFinished,(const SystemProcessObjectRef &sender), ObservableCombinerRunAllComponent)
 

Private Member Functions

 MAXON_INTERFACE (SystemProcessObjectInterface, MAXON_REFERENCE_NORMAL, "net.maxon.interface.systemprocessobject")
 

Member Function Documentation

◆ MAXON_INTERFACE()

MAXON_INTERFACE ( SystemProcessObjectInterface  ,
MAXON_REFERENCE_NORMAL  ,
"net.maxon.interface.systemprocessobject"   
)
private

◆ StartProcess()

MAXON_METHOD Result<void> StartProcess ( )

Executes the prepared process. This only works once. To start the same executable again you need to allocate another instance with the same settings.

Returns
OK on success.

◆ KillProcess()

MAXON_METHOD Result<void> KillProcess ( )

Kills the process if it is still running. All child processes are also killed.

Returns
OK on success. If the process was not running SystemProcessOperationError is returned.

◆ GetExitCode()

MAXON_METHOD Int GetExitCode ( ) const

Returns the exit code of the execution. This is possible as soon as the process finished. Note: The exit code under OS X only works for own child processes. Under Windows the exit code is available for all processes.

Returns
Returns the exit code of the process or (UInt)NOTOK if the process is still running.

◆ IsRunning()

MAXON_METHOD Bool IsRunning ( ) const

Returns whether the process is running or not.

Returns
True if the process is running.

◆ GetProcessId()

MAXON_METHOD UInt GetProcessId ( ) const

Returns the System Process Id.

Returns
The system process id (pid).

◆ GetProcessHandle()

MAXON_METHOD void* GetProcessHandle ( ) const

Returns the pointer to the windows process handle.

Returns
Windows: HANDLE of the windows process. OS X: pid of the process.

◆ GetProcessUrl()

MAXON_METHOD Url GetProcessUrl ( ) const

Returns the file path to the executable. Notes: Under windows the full path is only returned for processes that the user owns. System processes are only given by name. Under OS X the name is limited to the first 10 characters at the moment.

Returns
File name of the executable.

◆ GetLogFile()

MAXON_METHOD Url GetLogFile ( ) const

Returns the path of the captured logfile.

Returns
Return the log file path. If the process was not created using EXECUTEPROGRAMFLAGS::CAPTURELOGFILE an empty name is returned.

◆ GetUserData()

MAXON_METHOD void* GetUserData ( ) const

Returns the user data connected to this process. See SystemProcessInterface::CreateProcess().

Returns
Return the pointer to the user data of this process.

◆ GetLoadedDlls()

MAXON_METHOD Result<void> GetLoadedDlls ( const ValueReceiver< const DllRef & > &  dlls) const

Gets an array of all loaded dlls for this process.

Returns
OK on success.

◆ MAXON_OBSERVABLE()

MAXON_OBSERVABLE ( void  ,
ObservableProcessFinished  ,
(const SystemProcessObjectRef &sender)  ,
ObservableCombinerRunAllComponent   
)

Signal that the process finished execution. Make sure that you add this notification before you start the process, otherwise it could be too late if the process already ended.

Parameters
[in]senderReference to the SystemProcessObjectRef which has been finished.
Returns
ObservableRef to operate on.