Delphi: how to access other application controls?

I want to “view” the information displayed by another application, and “click” various buttons to automate the process. I have never done this before and would appreciate any advice on where to start and / or links.

+3
source share
4 answers

The right way to automate another application on the Windows platform is to use the Automation UI infrastructure . He supports . Net and COM API with the same level of functionality.

Disclaimer . I have not touched Delphi for years, so I have no idea which one will be easier for you to use.

Please note that user interface automation only works with XP and above; if for some reason you need to automate applications on Win2k or Win9x, you should familiarize yourself with the Windows Active Accessibility API .

+3
source

With some, SendMessage()you can mimic a user interacting with any program you want. This is the heart of all Auto-Click or Macro programs.

WinSight (Borland\Delphi7\Bin\WS32.EXE) , SendMessage(). FindWindow().

+7

WinDowse ( ) .

, , x, y

Procedure PressButtonXY(handleWnd : HWND;X,Y : Integer);   //X,Y are relative to the client area, you can use ScreenToClient to obtain this.
var
LParam    : Integer;
begin
LParam    := MakeLong(X, Y);
PostMessage(handleWnd, WM_LBUTTONDOWN, MK_LBUTTON, LParam);
PostMessage(handleWnd, WM_LBUTTONUP, MK_LBUTTON, LParam);
end;
+7

, , , Vista ( Windows 7). , , , .

+1

Source: https://habr.com/ru/post/1715486/


All Articles