DotNetDupe
4.0.6
C++17/20 Implementation of the .NET Base Class Library (BCL)
Toggle main menu visibility
Loading...
Searching...
No Matches
Process.h
Go to the documentation of this file.
1
3
4
#pragma once
5
6
#include "
Common.h
"
7
#include "
System/Object.h
"
8
#include "
System/String.h
"
9
#include "
System/SmartPointer.h
"
10
#include "
System/Array.h
"
11
12
namespace
DotNetDupe
{
13
namespace
System
{
14
namespace
Diagnostics
{
15
17
class
ProcessStartInfo
:
public
Object
{
18
public
:
19
DOTNETDUPE_API
ProcessStartInfo
();
20
DOTNETDUPE_API
ProcessStartInfo
(
const
String
& sFileName);
21
DOTNETDUPE_API
ProcessStartInfo
(
const
String
& sFileName,
const
String
& sArguments);
22
23
String
FileName
;
24
String
Arguments
;
25
String
WorkingDirectory
;
26
bool
CreateNoWindow
;
27
bool
UseShellExecute
;
28
};
29
38
class
Process
:
public
Object
{
39
public
:
40
DOTNETDUPE_API
Process
();
41
DOTNETDUPE_API
Process
(
int
iId,
const
String
& sProcessName,
void
* pProcessHandle =
nullptr
);
42
DOTNETDUPE_API
virtual
~Process
();
43
44
DOTNETDUPE_API
ProcessStartInfo
GetStartInfo
()
const
{
return
m_objStartInfo; }
45
DOTNETDUPE_API
void
SetStartInfo
(
const
ProcessStartInfo
& objStartInfo) { m_objStartInfo = objStartInfo; }
46
49
DOTNETDUPE_API
bool
Start
();
50
54
DOTNETDUPE_API
static
SmartPointer<Process>
Start
(
const
String
& sFileName);
55
60
DOTNETDUPE_API
static
SmartPointer<Process>
Start
(
const
String
& sFileName,
const
String
& sArguments);
61
65
DOTNETDUPE_API
static
SmartPointer<Process>
Start
(
const
ProcessStartInfo
& objStartInfo);
66
68
DOTNETDUPE_API
void
WaitForExit
();
69
73
DOTNETDUPE_API
bool
WaitForExit
(
int
iMilliseconds);
74
77
DOTNETDUPE_API
int
GetExitCode
()
const
{
return
m_iExitCode; }
78
81
DOTNETDUPE_API
bool
GetHasExited
()
const
;
82
85
DOTNETDUPE_API
int
GetId
()
const
{
return
m_iId; }
86
89
DOTNETDUPE_API
String
GetProcessName
()
const
{
return
m_sProcessName; }
90
93
DOTNETDUPE_API
static
int
GetCurrentProcessId
();
94
97
DOTNETDUPE_API
static
SmartPointer<Process>
GetCurrentProcess
();
98
101
DOTNETDUPE_API
static
Array<SmartPointer<Process>
>
GetProcesses
();
102
106
DOTNETDUPE_API
static
SmartPointer<Process>
GetProcessById
(
int
iProcessId);
107
111
DOTNETDUPE_API
static
Array<SmartPointer<Process>
>
GetProcessesByName
(
const
String
& sProcessName);
112
114
DOTNETDUPE_API
void
Kill
();
115
116
private
:
117
ProcessStartInfo
m_objStartInfo;
118
int
m_iId;
119
String
m_sProcessName;
120
mutable
int
m_iExitCode;
121
mutable
bool
m_bHasExited;
122
void
* m_pProcessHandle;
123
124
void
Refresh()
const
;
125
};
126
}
127
}
128
}
Array.h
Provides methods for creating, manipulating, searching, and sorting arrays.
Common.h
Defines common cross-platform macros, export decorators, and fundamental types.
DOTNETDUPE_API
#define DOTNETDUPE_API
Platform-specific linkage decoration for exporting or importing library symbols.
Definition
Common.h:20
Object.h
Base object class for DotNetDupe mirroring .NET System.Object.
SmartPointer.h
Provides reference-counted and weak pointer memory management primitives ensuring zero raw ownership.
String.h
High-performance UTF-8 / UTF-16 string manipulation class mirroring .NET System.String.
DotNetDupe::System::Array
Provides methods for creating, manipulating, searching, and sorting arrays, thereby serving as the ba...
Definition
Array.h:29
DotNetDupe::System::Diagnostics::Process::GetCurrentProcessId
static int GetCurrentProcessId()
Gets the process identifier of the calling process.
Definition
Process.cpp:282
DotNetDupe::System::Diagnostics::Process::Start
bool Start()
Starts (or reuses) the process resource that is specified by the StartInfo property.
Definition
Process.cpp:221
DotNetDupe::System::Diagnostics::Process::GetProcesses
static Array< SmartPointer< Process > > GetProcesses()
Creates an array of new Process components and associates them with all active system processes.
Definition
Process.cpp:369
DotNetDupe::System::Diagnostics::Process::GetProcessName
String GetProcessName() const
Gets the name of the process.
Definition
Process.h:89
DotNetDupe::System::Diagnostics::Process::GetProcessById
static SmartPointer< Process > GetProcessById(int iProcessId)
Returns a Process component given the identifier of a process on the local computer.
Definition
Process.cpp:392
DotNetDupe::System::Diagnostics::Process::Process
Process()
Definition
Process.cpp:43
DotNetDupe::System::Diagnostics::Process::WaitForExit
void WaitForExit()
Instructs the Process component to wait indefinitely for the associated process to exit.
Definition
Process.cpp:245
DotNetDupe::System::Diagnostics::Process::GetStartInfo
ProcessStartInfo GetStartInfo() const
Definition
Process.h:44
DotNetDupe::System::Diagnostics::Process::GetId
int GetId() const
Gets the unique identifier for the associated process.
Definition
Process.h:85
DotNetDupe::System::Diagnostics::Process::GetExitCode
int GetExitCode() const
Gets the value that the associated process specified when it terminated.
Definition
Process.h:77
DotNetDupe::System::Diagnostics::Process::GetProcessesByName
static Array< SmartPointer< Process > > GetProcessesByName(const String &sProcessName)
Creates an array of new Process components and associates them with all processes sharing the specifi...
Definition
Process.cpp:420
DotNetDupe::System::Diagnostics::Process::Kill
void Kill()
Immediately stops the associated process.
Definition
Process.cpp:271
DotNetDupe::System::Diagnostics::Process::GetHasExited
bool GetHasExited() const
Gets a value indicating whether the associated process has been terminated.
Definition
Process.cpp:266
DotNetDupe::System::Diagnostics::Process::GetCurrentProcess
static SmartPointer< Process > GetCurrentProcess()
Gets a new Process component and associates it with the currently active process.
Definition
Process.cpp:409
DotNetDupe::System::Diagnostics::Process::SetStartInfo
void SetStartInfo(const ProcessStartInfo &objStartInfo)
Definition
Process.h:45
DotNetDupe::System::Diagnostics::ProcessStartInfo
Specifies a set of values that are used when you start a process.
Definition
Process.h:17
DotNetDupe::System::Diagnostics::ProcessStartInfo::Arguments
String Arguments
Definition
Process.h:24
DotNetDupe::System::Diagnostics::ProcessStartInfo::CreateNoWindow
bool CreateNoWindow
Definition
Process.h:26
DotNetDupe::System::Diagnostics::ProcessStartInfo::UseShellExecute
bool UseShellExecute
Definition
Process.h:27
DotNetDupe::System::Diagnostics::ProcessStartInfo::ProcessStartInfo
ProcessStartInfo()
Definition
Process.cpp:34
DotNetDupe::System::Diagnostics::ProcessStartInfo::WorkingDirectory
String WorkingDirectory
Definition
Process.h:25
DotNetDupe::System::Diagnostics::ProcessStartInfo::FileName
String FileName
Definition
Process.h:23
DotNetDupe::System::Object
Supports all classes in the DotNetDupe class hierarchy.
Definition
Object.h:18
DotNetDupe::System::SmartPointer
A unified smart pointer that supports both unique and shared ownership semantics.
Definition
SmartPointer.h:72
DotNetDupe::System::String
Represents text as a sequence of UTF-8 code units with culture-invariant operations.
Definition
String.h:74
DotNetDupe::System::Diagnostics
Definition
ActiveUserSession.h:11
DotNetDupe::System
Definition
Action.h:11
DotNetDupe
Definition
IServiceCollection.h:7
Include
System
Diagnostics
Process.h
Generated by
1.18.0