Tuesday, 15 July 2014

C# Wait for a Progam/Process to start -


How can I create a program that will activate a code when a program / process has opened without launching the program I went.

Now I have this code:

  while (! IPPROSSE OPEN ("this process")) // "FAPROCESSES OPEN" simply checks whether the program works Open manager {} Gopatch.DoWork + = New DoWorkEventHandler (gopatch_DoWork); Gopatch.RunWorkerCompleted + = New RunWorker Component Action Handler (gopatch_RunWorkerCompleted); Gopatch.RunWorkerAsync ();   

But in this way CPU usage is very high. Is this a way to use less CPU, but should I have to do this work?

To prevent excessive CPU usage, you can thread in your loop. Sleep can use the method. It is not optimal, but it is simple if you want something better then try to use the event How to use ManagementEventWatcher to do this.

No comments:

Post a Comment