How to get descriptors of various controls with the same class name?

I am trying to access a third-party Text Fields application using delphi programming, so I need to find the handle of each "text field" using the FindWindowEx (...) function.

The problem is that all text fields have the same class name with "NO window name", this function can just give me the first TextBOx descriptor!

How can I process the rest of the text fields until they have names?

Thanks in advance.

+3
source share
2 answers

EnumChildWindows , , " ". :

function EnumChildren(hwnd: HWND; lParam: LPARAM): BOOL; stdcall;
const
  TextBoxClass = 'EDIT'; (?)
var
  ClassName: array[0..259] of Char;
begin
  Result := True;
  GetClassName(hwnd, ClassName, Length(ClassName));
  if ClassName = TextBoxClass then
    TStrings(lParam).Add(IntToHex(hwnd, 8));
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  Memo1.Clear;
  EnumChildWindows(OtherAppWnd, @EnumChildren, UINT_PTR(Memo1.Lines));
end;
+9

FindWindowEx(), , , Spy ++, Winspector . , , , .., FindWindowEx(). , Dialog ( VCL , Microsoft), GetDlgItem() , , (, Spy ++ , , ).

+1

All Articles