
07.11.2015, 23:24
|
Модератор
|
|
Регистрация: 17.04.2008
Сообщения: 8,088
Версия Delphi: 7, XE3, 10.2
Репутация: 49089
|
|
Код просто поправил, логику не проверял:
Код:
unit Unit1;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.ExtCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
public
end;
var
Form1: TForm1;
n: Integer;
implementation
{$R *.dfm}
function EnumWindowsProc(wHandle: HWND; Param: Pointer): BOOL; stdcall;
var
Title, ClassName: array[0..255] of char;
begin
GetWindowText(wHandle, Title, 255);
GetClassName(wHandle, ClassName, 255);
if IsWindowVisible(wHandle) and (ClassName = 'TForm8')
then begin
Inc(n);
SetWindowText(wHandle, Format('Кукарямба %d', [n]));
end;
Result := True;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
n := 0;
EnumWindows(@EnumWindowsProc, 0);
end;
end.
|