I just downloaded this Open-Source Program:
http://fabi.me/tools/processfreezer/
and I want to modify something in it. But I really don't know how...
This program allows you to freeze a process. You select the process through a Listbox. But I just want to freeze a one specific program which is manually given in a string.
For example:
string process = "C:\\Program Files (x86)\\yolo\\yolo.exe";
How can I override the Listbox and give that information to the suspend function?
Here's the code
Process[] GetCheckedProcesses()
{
Process[] procs = new Process[lvProcesses.CheckedItems.Count];
for (int i = 0; i < procs.Length; i++)
procs[i] = (Process)lvProcesses.CheckedItems[i].Tag;
return procs;
}
private void btnSuspend_Click(object sender, EventArgs e)
{
Process[] procs = GetCheckedProcesses();
for (int i = 0; i < procs.Length; i++)
{
try { ProcessFreezer.SuspendProcess(procs[i]); ; }
catch (Exception ex) { MessageBox.Show(ex.ToString(), "FEHLER"); }
}
}
Here's a snippet of ProcessIsSuspend
public static bool ProcessIsSuspended(Process proc)
{
bool suspended = true;
foreach (ProcessThread pT in proc.Threads)
suspended &= ( pT.ThreadState == System.Diagnostics.ThreadState.Wait
&& pT.WaitReason == ThreadWaitReason.Suspended );
return suspended;
}
So the Button should just freeze the process without asking which...
Hopefully its understandable. I just started with C# and its a bit different to C++