Autor Beitrag
spike0
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 77



BeitragVerfasst: Fr 25.11.05 19:11 
Wie geht so etwas:
Ich habe z.B. Wordpad offen, und dann öffne ich mein Programm. Ich gebe in ein TMemo-Feld einen Text ein. Nun möchte ich, dass ich z.b. auf Bearbeiten->Einfügen in (hier kommt der Name des Fensters, also Wordpad.exe) klicke, und der Text dann dort eingefügt wird. Am besten wäre es, wenn es auch bei Edit-Feldern funktionieren könnte.

Danke im Vorraus...
SAiBOT
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 323
Erhaltene Danke: 6

XP SP2; 7
D7; D2009
BeitragVerfasst: Sa 26.11.05 19:43 
spike0 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 77



BeitragVerfasst: Di 29.11.05 19:41 
Also, ich hab es etwas umgeändert: ich will jetzt einen Text aus einem TMemo in das Delphi-Fenster (genauer: in den Delphi-Editor) einfügen
Ich hab provisorisch so etwas versucht, aber noch nicht mal das klappt:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
var par,chi:thandle;
begin
clipboard.AsText:='Hallo'// Zwischenablage=Hallo, später Memo1.Text
par:=FindWindow(nil,'Unit1.pas'); //Ich finde das Fenster
chi := FindWindowEx(chi, 0'TEditControl'nil); // Suche TEditControl (ich hab mit einem Programm nachgeguckt,
                                                  // welche Klasse dieses Memo-Feld hat, und es ist eben TEditControl)
SendMessage(chi, WM_PASTE, 00); // Text einfügen


Also:
1. Die Suche des Fensters ist äußerst uneffektiv: es kommt selten vor, das dieses fenster eben 'Unit1' als Titel hat. Wie kann man es Besser machen?
2. Wieso funktioniert es insgesammt nicht?