Mega Code Archive

 
Categories / Delphi / Examples
 

Jump to a specific edit component in a foreign application

Title: jump to a specific edit component in a foreign application? { Bei manchen Fremdanwendungen sind die Editfelder ( oder auch memos, combos - egal ) alle mit dem selben Namen versehen. Wenn ich nun in das 5. Editfeld der Fremdanwendung einen Eintrag aus meiner Applikation machen will, steh ich vor einem Problem, weil durch die selbe Namensgebung der Felder immer das erste angesprochen wird. Diese Funktion + Beipiel löst das Problem ohne Kopfzerbrechen } { If you need to jump to an edit field (or memo / combo /...) within a foreign application using the same name for many controls, then use this function and the sample code to locate the right one} function jmpwnd(hand: hwnd; anz: Integer): hwnd; var i: Integer; begin for i := 1 to anz do hand := getwindow(hand, gw_hwndnext); jmpwnd := hand; end; { Code-Beipiel } { Sample use } //Handle vom ERSTEN Edit Feld finden... //Find the handle of the first edit field history := FindWindowEx(hMDIChildAccHis, 0,'_T_Edit', nil); //...jump to the second one (having the same name) //...spring in das ZWEITE Edit Feld history := jmpwnd(history, 2); // ins 2.Edit Feld den Eintrag machen // write something in this field SendMessage(history, WM_SETTEXT, 0,Integer(PChar('ComboBox3.Text)));