Hi,
Ich habe mir dafür mal eine Funktion geschrieben:
// hWin: Handle des Parent Controls/Fensters
// ControlClassName: Klassenname des zu suchenden Controls
// Nr. des Controls, (Wenn es mehrere Controls dieser Klasse gibt)
Delphi-Quelltext
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19:
| function FindControlByNumber(hWin: HWND; ControlClassName: string; ControlNr: Word = 1): HWND; var i: Word; hControl: HWND; begin Result := 0; if IsWindow(hWin) then begin Dec(ControlNr); hControl := 0; for i := 0 to ControlNr do begin hControl := FindWindowEx(hWin, hControl, PChar(ControlClassName), nil); if hControl = 0 then Exit; end; end; Result := hControl; end; |