Hi Gang, Does anyone know how to get an os handle (windows) to a running program (not current, like xxx.exe). I want to get info about it like its PID, how much memory it is using and the like. Lou
-- You received this message because you are subscribed to the Google Groups "VA Smalltalk" group. To view this discussion on the web visit https://groups.google.com/d/msg/va-smalltalk/-/qGTWvU1-PtIJ. To post to this group, send email to [hidden email]. To unsubscribe from this group, send email to [hidden email]. For more options, visit this group at http://groups.google.com/group/va-smalltalk?hl=en. |
Well, I have an answer to my own question but I'm still a little confused:( The snippet of code below will get handles and PIDs for all the running programs (at least that is what I think they are). What I find confusing is that some of the handles look like PIDs (when checked in the Windows Task Managed) those handles that look like PIDs get 0 when I ask for its PID. Does anyone know enough about C and Windows to tell me what's going on here? | pf osProcessesArray osProcessCountReturned osProcesses osProcessCount result pIds | Bigger picture. I am trying to find the handle of one program (maybe two) in-particular. So, I need to find the name of the Exe that is running from the handle. When I find the program I want I then need to get its PID and other info like how much memory and CPU it is using. Lou
-- You received this message because you are subscribed to the Google Groups "VA Smalltalk" group. To view this discussion on the web visit https://groups.google.com/d/msg/va-smalltalk/-/eLqs5VB4MFYJ. To post to this group, send email to [hidden email]. To unsubscribe from this group, send email to [hidden email]. For more options, visit this group at http://groups.google.com/group/va-smalltalk?hl=en. |
The code you posted is flawed. The enumProcesses API returns a list of PIDs, yet you later interpret it as if they were window handles (which is what getWindowThreadProcessId uses). Why don't you use FindWindow or FindWindowEx to get a window handle, they you can use getWindowThreadProcessId to get its PID? Normand On Monday, October 29, 2012 3:37:45 PM UTC-4, Louis LaBrunda wrote: -- You received this message because you are subscribed to the Google Groups "VA Smalltalk" group. To view this discussion on the web visit https://groups.google.com/d/msg/va-smalltalk/-/u4lnGRSJflIJ. To post to this group, send email to [hidden email]. To unsubscribe from this group, send email to [hidden email]. For more options, visit this group at http://groups.google.com/group/va-smalltalk?hl=en. |
Hi Normand, Thanks for the reply. For some reason I thought EnumProcesses was returning a list of handles, which is among other things is what I was looking for. I will look at FindWindow again (but what I'm looking for doesn't run in a window). At this point I am still in a bit of a fog as we just got power back on after six days. Lou
-- You received this message because you are subscribed to the Google Groups "VA Smalltalk" group. To view this discussion on the web visit https://groups.google.com/d/msg/va-smalltalk/-/ydNreO77FU8J. To post to this group, send email to [hidden email]. To unsubscribe from this group, send email to [hidden email]. For more options, visit this group at http://groups.google.com/group/va-smalltalk?hl=en. |
I extended OSCall with the code below (getProcessIds) to get an array of program ids (PIDs). I then use: OSHandle openProcess: ProcessAllAccess fInherit: false iDProcess: pId to get a handle. Lou getProcessIds-- You received this message because you are subscribed to the Google Groups "VA Smalltalk" group. To view this discussion on the web visit https://groups.google.com/d/msg/va-smalltalk/-/_0wJgmNqE84J. To post to this group, send email to [hidden email]. To unsubscribe from this group, send email to [hidden email]. For more options, visit this group at http://groups.google.com/group/va-smalltalk?hl=en. |
Free forum by Nabble | Edit this page |