Jump to content
Sign in to follow this  
user32462308

Find number of threads given a PID

Recommended Posts

user32462308

Hi, I'm new to Autoit, but I'm hoping you guys can help me out.

Is there an "Autoit" way to get the number of threads a process is using, given the process id (PID)?

I know about ProcessList and ProcessGetStats, but neither of those have the current number of threads running for a process.

I tried searching around, and couldn't find anything. I might just be bad at searching.

Thanks!

Share this post


Link to post
Share on other sites
user32462308

Nevermind, I found this function via pastebin that executes a WMI query:

http://pastebin.com/jdnE6ZLG

I just used the QueryWMI function to select ThreadCount from Win32_Process as seen below:

$pid = Run("notepad.exe")

ConsoleWrite(QueryWMI("SELECT * FROM Win32_Process WHERE ProcessId = " & $pid & " DISPLAY ThreadCount"))

There is probably a better way, but this worked for me.

Edited by user32462308

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  

×