Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)

Paste

Pasted as Plain Text by adadw ( 14 years ago )
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
   
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;
   wnd:HWnd;

implementation

{$R *.dfm}


procedure ClickOnForm(wnd: HWND; caption: string);
var 
TheChildHandle: HWND; 
begin 
try 
TheChildHandle := FindWindowEx(wnd, 0, nil, PChar(caption));
SendMessage(TheChildHandle, $0201, 1, 1); 
SendMessage(TheChildHandle, $0202, 1, 1); 
except end; 
end; 

procedure TForm1.Button1Click; 
var 
wnd: HWND;
caption: string; 
begin 
try 
wnd := GetTopWindow(0); 
repeat 
SetLength(caption, GetWindowtextLength(wnd)); 
GetWindowText(wnd, @caption[1], length(caption) + 1); 
if (trim(caption) = 'Авторизация — Rublik') then ClickOnForm(wnd, 'Войти');
wnd := GetNextWindow(wnd, GW_HWNDNEXT); 
until wnd = 0; 
except end; 
end;
end.

 

Revise this Paste

Your Name: Code Language: