RE: Determine Handle Count associated with a running process.
From: Ran Liang[MSFT] (v-liangr_at_online.microsoft.com)
Date: 02/24/04
- Next message: Alexander Kienzle: "Re: WM_MEASUREITEM for a TabStrip control"
- Previous message: Mike Hudson: "Re: Window Location From Hwnd"
- In reply to: icontin: "Determine Handle Count associated with a running process."
- Next in thread: icontin: "RE: Determine Handle Count associated with a running process."
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 24 Feb 2004 12:18:00 GMT
Hi icontin,
Thank you for posting in the community!
First of all, I'd like to confirm my understanding of your issue. You
indicated that you want to get the handle counts of object handles in a
process. Have I fully understood you? If there's any misunderstanding,
please feel free to let me know.
Based on my research, I suggest you to use Windows Management
Instrumentation (WMI) to implement the corresponding function. WMI provides
you with a standard way to interact with system management information and
the underlying WMI APIs.
I have created a test project in VB codes on my site, which gets handle
counts of all the running process on the local machine, and I pasted the
source codes as follows for your reference.
Please note that before running the vb codes, you should add the "Microsoft
WMI Scripting V1.2 Library" reference in VB at first.
[Reference Codes]
Private Sub Command1_Click()
For Each Process In
GetObject("winmgmts:{impersonationLevel=impersonate}").InstancesOf("Win32_pr
ocess")
'get process name
Dim aa As String
Debug.Print Process.name
aa = Process.name
aa = Left(aa, Len(aa) - 4)
'get handle counts
Set RawProc =
GetObject("winmgmts:Win32_PerfRawdata_Perfproc_process.name='" + aa + "'")
Set CookedProc =
GetObject("winmgmts:Win32_Perfformatteddata_Perfproc_process.name='" + aa +
"'")
Debug.Print aa & " process HandleCount" & RawProc.HandleCount
Debug.Print aa & " Process HandleCount" & CookedProc.HandleCount
Next
End Sub
If you have any other problems or concerns, please feel free to post it in
the community. I'm always standing by to be of assistance.
Best Regards,
Liang Ran [MSFT]
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties and confers no rights.
- Next message: Alexander Kienzle: "Re: WM_MEASUREITEM for a TabStrip control"
- Previous message: Mike Hudson: "Re: Window Location From Hwnd"
- In reply to: icontin: "Determine Handle Count associated with a running process."
- Next in thread: icontin: "RE: Determine Handle Count associated with a running process."
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|