whats new ¦  programming tips ¦  indy articles ¦  intraweb articles ¦  informations ¦  links ¦  interviews
 misc ¦  tutorials ¦  Add&Win Game

Tips (1541)

Database (90)
Files (137)
Forms (107)
Graphic (114)
IDE (21)
Indy (5)
Internet / LAN (130)
IntraWeb (0)
Math (76)
Misc (126)
Multimedia (45)
Objects/
ActiveX (51)

OpenTools API (3)
Printing (35)
Strings (83)
System (266)
VCL (242)

Top15

Tips sort by
component


Search Tip

Add new Tip

Add&Win Game

Advertising

51 Visitors Online


 
...jump to a specific edit component in a foreign application?
Autor: Dirk Metzger
Homepage: http://www.surfing-bytes.de
[ Print tip ]  

Tip Rating (11):  
     


{ 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); 

<- - Funktion ansprechen

// ins 2.Edit Feld den Eintrag machen
// write something in this field
SendMessage(history, WM_SETTEXT, 0,Integer(PChar('ComboBox3.Text)));


 

Rate this tip:

poor
very good


Copyright © by SwissDelphiCenter.ch
All trademarks are the sole property of their respective owners