Jump to content
Sign in to follow this  

Enumerating Processes - Revisited

Recommended Posts

Jon, since you rejected the first enumeration method I submitted, I've decided to try a different approach.

Since PID's are now accepted in all the process functions, ProcessEnumerate() could return an array of every PID in the system. Then, in order to find the name, an additional function could be added which returns the name of a process based on its PID. Some example code might look like:

$pids = ProcessEnumerate()
For $i = 1 To $pids[0]
    If ProcessName($pids[$i]) = "notepad.exe" Then
       ; Do something

Would this be a better fit?

Share this post

Link to post
Share on other sites

Yeah, I like that.

Maybe a optional parameter for Enumerate too that can specifiy what is returned - names or pids.

And maybe a general conversion pid <-> name function. If the parameter is a number then assume pid and return name, if the parameter is a string then assume name and return pid. Or something?

I intend to do something similar for window titles too.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...