2
Answers

How can I set a property value by its name?

Photo of ultra2

ultra2

19y
1.6k
1
I want to set an object's property value by its name: function SetProp(Obj object, PropName string) { ?? }

Answers (2)

0
Photo of dominic scanlan
NA 2 0 15y

Process
p = Process.GetCurrentProcess();
int i = p.Id;
0
Photo of Lalit M
NA 6.7k 48k 15y
use this code sample to get PID

using System.Diagnostics;
private void GetProcessStatus()
{
try
{
//If you know the name of the process
Process[] myProcesses = Process.GetProcessesByName("mspaint");
//If you know the PID of the process use the commented line below
//Process[] myProcesses = Process.GetProcessById("2341");
//Check to see if the process array length is greater than 0
if(myProcesses.Length > 0)
{
MessageBox.Show("The Process Microsoft Paint(mspaint) is currently running.", "Process Status", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
else
{
MessageBox.Show("The Process Microsoft Paint(mspaint) is currently NOT running.", "Process Status", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
catch(Exception ex)
{
MessageBox.Show("An Exception Occoured: " + ex.Message, "Process Status", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}


check also