Example #1
0
 static void TestProcessSearch()
 {
     //uint[] IDs = NativeProcess.SearchProcessIds();
     //if (null != IDs && IDs.Length > 0)
     //{
     //	StringBuilder msg = new StringBuilder("{");
     //	msg.Append(IDs[0]);
     //	for (int i = 1; i < IDs.Length; i++)
     //	{
     //		msg.Append(", ").Append(IDs[i]);
     //	}
     //	msg.Append("}");
     //	MessageBox.Show(msg.ToString());
     //}
     //else
     //{
     //	MessageBox.Show("Process IDs array was null or empty! Error code: " + NativeProcess.GetError());
     //}
     ProcessInfo[] infos = NativeProcess.SearchProcesses();
     if (null != infos && infos.Length > 0)
     {
         StringBuilder msg = new StringBuilder();
         for (int i = 0; i < infos.Length; i++)
         {
             msg.Append(infos[i].ProcessID).Append('\t').AppendLine(infos[i].ImageName);
         }
         MessageBox.Show(msg.ToString());
     }
     else
     {
         MessageBox.Show("ProcessInfos array was null or empty! Error code: " + NativeProcess.GetError());
     }
 }