in reply to Detect new processes on a Win32 machine as they are created using Win32::OLE

Well, I think ProcessID is the unique identifier for the processes. On the first iteration simply stuff every ProcessID you find into a hash, then on next iteration print out those that didn't appear in the hash.
  • Comment on Re: Detect new processes on a Win32 machine as they are created using Win32::OLE

Replies are listed 'Best First'.
Re: Re: Detect new processes on a Win32 machine as they are created using Win32::OLE
by waswas-fng (Curate) on Mar 18, 2004 at 21:37 UTC
    Thats a race condition, What happens to the processes that are created and end between the hash++ loop?


    -Waswas
      That depends on what he needs the list of new processes for. If it is for something as simple as highlighting new processes in a listing, he wouldn't care about processes that have already exited.

      However, the only way I can see of making sure you'd see every process, no matter how fast it exited, is by some sort of a callback that would be triggered by process creation. Perhaps the Win32 API offers that, I don't know. But that's not the question that was asked.