» Help

Code Snippets Database

Control Box
 
 

Requested snippet

This page displays the requested FormInstanceCount_B snippet.

You can choose a category, perform a search or generate a Pascal unit containing the snippet by using the Control Box.

FormInstanceCount_B
Returns how many form instances exist with a given class name currently exist.
function FormInstanceCount(const AFormClassName: string): Integer; overload;
var
  I: Integer;  // loops through all forms
begin
  Result := 0;
  for I := 0 to Forms.Screen.FormCount - 1 do
    Inc(Result, Ord(Forms.Screen.Forms[I].ClassNameIs(AFormClassName)));
end;
Kind of Snippet: Routine
Required units: Forms.
Required snippets: None.
Supported Compilers:
 D2   D3   D4   D5   D6   D7  D2005
(Win32)
D2006
(Win32)
D2007 D2009
(Win32)
D2010
(Win32)
Free
Pascal
Red LED Red LED Green LED Green LED Green LED Green LED Green LED Green LED Green LED Green LED Green LED Red LED
This snippet cannot be included in generated units.