...Count the window handles used by your app?

Author: P. Below

Category: Misc


function EnumProc(wnd: HWND; var count: DWORD): Bool; stdcall;
begin
  
Inc(count);
  result := True;
  EnumChildWindows(wnd, @EnumProc, integer(@count));
end;

procedure TForm1.Button1Click(Sender: TObject);
var
  
count: DWORD;
begin
  
count := 0;
  EnumThreadWindows(GetCurrentThreadID, @EnumProc, Integer(@count));
  Caption := Format('%d window handles in use', [count]);
end;

 

printed from
www.swissdelphicenter.ch
developers knowledge base