I have created a simple List function but if I Loop through the List it's empty. It should not be!
// List function
public class process_hook
{
public static List<String> pro_hook = new List<String>
(new String[] { list_all_pocesses() });
protected static string list_all_pocesses()
{
StringBuilder _list = new StringBuilder();
foreach (Process i in Process.GetProcesses("."))
{
try
{
foreach (ProcessModule pm in i.Modules)
{
pro_hook.Add(pm.FileName.ToString());
}
}
catch { }
}
return _list.ToString();
}
}
// call
private void button1_Click(object sender, EventArgs e)
{
foreach (String _list in process_hook.pro_hook)
{
Console.WriteLine(_list);
}
}