How to get count of opened handles that belongs to a certain process? How to get count of opened handles that belongs to a certain process? windows windows

How to get count of opened handles that belongs to a certain process?


Use the GetProcessHandleCount function. This API function is in recent versions of Delphi imported by the Winapi.Windows unit (so you can omit the presented one):

function GetProcessHandleCount(hProcess: THandle; var pdwHandleCount: DWORD): BOOL; stdcall;  external 'kernel32.dll';procedure TForm1.Button1Click(Sender: TObject);var  HandleCount: DWORD;begin  if GetProcessHandleCount(GetCurrentProcess, HandleCount) then    ShowMessage('Handle count: ' + IntToStr(HandleCount));end;