procedure TForm4.Timer1Timer(Sender: TObject);
var
S:
string;
H: HWND;
C: TControl;
B:
array[0..MAX_PATH]
of Char;
i: Integer;
begin
if Application.Active
then S := '
Active '
else S := '
Inactive ';
if Assigned(Screen.ActiveCustomForm)
then
S := S + Screen.ActiveCustomForm.ClassName + '
.' + Screen.ActiveCustomForm.
Name + '
';
if Assigned(Screen.ActiveForm)
and Assigned(Screen.ActiveForm.ActiveMDIChild)
then
S := S + '
MDI:' + Screen.ActiveForm.ActiveMDIChild.ClassName + '
.' + Screen.ActiveForm.ActiveMDIChild.
Name + '
';
if Assigned(Screen.ActiveControl)
then
S := S + Screen.ActiveControl.ClassName + '
.' + Screen.ActiveControl.
Name + '
';
H := GetActiveWindow;
C := FindControl(H);
if not Assigned(C)
then begin
GetClassName(H, @B, MAX_PATH);
S := S + '
(' + B + '
';
end else
S := S + '
(' + C.ClassName + '
.' + C.
Name + '
';
H := GetFocus;
C := FindControl(H);
if not Assigned(C)
then begin
GetClassName(H, @B, MAX_PATH);
S := S + B + '
) ';
end else
S := S + C.ClassName + '
.' + C.
Name + '
) ';
Application.Title := S;
for i := 0
to Screen.CustomFormCount - 1
do
Screen.CustomForms[i].Caption := S;
end;