mit Code, generiert von Winspy:
Code:
function FindWindowEx2(hParent: HWND; ChildClassName: string; ChildNr: Word): HWND;
var
i: Word;
hChild: HWND;
begin
hChild := 0;
Result := 0;
ChildNr := ChildNr - 1;
for i := 0 to ChildNr do
begin
hChild := FindWindowEx(hParent, hChild, PChar(ChildClassName), nil);
if hChild = 0 then
Exit;
Result := hChild;
end;
end;
procedure TForm1.Button2Click(Sender: TObject);
var
wnd: HWND;
begin
wnd := FindWindow('WindowsForms10.Window.8.app3','Anwendung');
wnd := FindWindowEx2(wnd,'WindowsForms10.BUTTON.app3', 2);
if wnd <> 0 then SendMessage(wnd, BM_Click, 0, 0);
end;
(den Code für die 2 Edits habe ich weggelassen)