如何知道系统总共使用了多少个句柄?
Windows的任务管理器有个功能,能显示系统总共使用了多少个句柄。如图,请问如何得到这个数量?Option Explicit
Private Declare Function GetProcessHandleCount Lib "kernel32" (ByVal ProcessHandle As Long, nCount As Long) As Long
Private Declare Function GetCurrentProcess Lib "kernel32.dll" () As Long
Private Sub Form_Load()
Dim i As Long
GetProcessHandleCount GetCurrentProcess, i
Debug.Print i
End Sub以上代码取得当前进程的句柄计数.
打开所有进程,并用这个函数取得单个进程计数后再累加即可.
注意,GetProcessHandleCount需要至少XP SP1才支持貌似. ZwQusystemInfoMation
页:
[1]