如何在沒有啓動所述程序本身的情況下打開程序/進程時啓動代碼來激活代碼。C#等待Progam /進程啓動
現在我有這樣的代碼:
while (!IsProcessOpen("ThisProcess")) //"IsProcessOpen" just checks whether the program stated is open in the task manager.
{
}
gopatch.DoWork += new DoWorkEventHandler(gopatch_DoWork);
gopatch.RunWorkerCompleted += new RunWorkerCompletedEventHandler(gopatch_RunWorkerCompleted);
gopatch.RunWorkerAsync();
但這種方式使用太多的CPU。有沒有辦法讓它使用更少的CPU,但完成工作,因爲我想要它?
使用WMI異步處理事件。 – SLaks