Autor Beitrag
amazing
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 32



BeitragVerfasst: Fr 18.04.08 16:27 
Hallo, ich hab Delphi seit einiger Zeit in der Schule und interessiere mich privat auch dafür.
Kann Deplphi, im Hintergrund laufend, auf ein externes Fenster 'zugreifen' z.B Editor und eine Textnachricht in Zeitabständen, welche z.B durch ein Editfeld vorgegeben werden kann, senden?

Der Timer würde sich ja dafür gut eigenen, aber wie bekomme ich Delphi dazu, das oben beschriebene zu amchen?


Moderiert von user profile iconChristian S.: Topic aus Delphi Language (Object-Pascal) / CLX verschoben am Fr 18.04.2008 um 18:00
Der nette Nachbar
ontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 67

Win XP, Suse Linux 9.3
Delphi 7, Delphi 2007, Borland C++ Builder 6, Java Builder 7
BeitragVerfasst: Fr 18.04.08 16:33 
Informiere dich tiefgehend über API Hooks, danach wirst du dein Problem ohne Mühe bewältigen können. xD
amazing Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 32



BeitragVerfasst: Fr 18.04.08 17:05 
Hm das sagt mir jetzt nichts, hat jemand einen Ansatz für mich?
Sinspin
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1338
Erhaltene Danke: 120

Win 10
RIO, CE, Lazarus
BeitragVerfasst: Fr 18.04.08 17:53 
Warum immer alle, naja einige, gleich mit API Hooks um sich werfen müssen, verstehe ich nicht.

Es reicht das Win-API Handle des Fensters zu kennen in das du schreiben willst.
Allerdings kommt dann deine Eingabe immer nur dort an wo gerade der Focus drauf ist (der Eingabecursor steht).

Schau dir mal das an:
www.delphi-forum.de/...mp;highlight=fenster

Da findest du eingentlich alles was du brauchst. Ansonsten, einfach mal hier im Forum suchen. (für den einen Link habe ich dir das ja schonmal abgenommen :wink: )

_________________
Wir zerstören die Natur und Wälder der Erde. Wir töten wilde Tiere für Trophäen. Wir produzieren Lebewesen als Massenware um sie nach wenigen Monaten zu töten. Warum sollte unser aller Mutter, die Natur, nicht die gleichen Rechte haben?
amazing Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 32



BeitragVerfasst: Fr 18.04.08 18:56 
Danke schonmal, nur habe ich soetwas in der Richtung noch nie probiert und bin eigentlich Anfänger.
Wenn ich jetzt dieses Handle habe, was dann?
amazing Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 32



BeitragVerfasst: Sa 19.04.08 19:16 
hm niemand? ist das hier eigentlich der richtige bereich für die frage?
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19346
Erhaltene Danke: 1754

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: So 20.04.08 05:44 
Wenn du ein Handle des Eingabefelds hast, dann kannst du zum Beispiel den Text darin setzen:
ausblenden Delphi-Quelltext
1:
SendMessage(TextfieldHandle, WM_SETTEXT, 0, Integer(PChar(DeinString)));					
amazing Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 32



BeitragVerfasst: So 20.04.08 20:23 
Sehr gut, danke!
Wie bekomme ich es hin, dass er nachdem er den Text geschickt hat, die Funktion der Taste Enter durchführt?

E: Damit ich besser weiter komme: was bedeutet die 0 und was bedeutet WM_SETTEXT?
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19346
Erhaltene Danke: 1754

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Mo 21.04.08 13:40 
user profile iconamazing hat folgendes geschrieben:
E: Damit ich besser weiter komme: was bedeutet die 0 und was bedeutet WM_SETTEXT?
msdn2.microsoft.com/...ms632644(VS.85).aspx ;-)
amazing Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 32



BeitragVerfasst: Di 22.04.08 15:27 
Kannst du mir sagen, wie ich den Enter-testendruck simulieren kann?
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19346
Erhaltene Danke: 1754

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Di 22.04.08 20:13 
toms
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1099
Erhaltene Danke: 2



BeitragVerfasst: Di 22.04.08 20:32 
user profile iconamazing hat folgendes geschrieben:
Kannst du mir sagen, wie ich den Enter-testendruck simulieren kann?


Google ist dein Freund!

Einfach mal folgende Suchwörter eingeben:

Suche bei Google ENTER SIMULIEREN DELPHI
amazing Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 32



BeitragVerfasst: Di 29.04.08 15:53 
Hab das mit der Entertaste noch nicht hinbekommen, welchen Keycode hat die Taste Enter denn?
Achja, kann Delphi das Handle auch manuell auslesen, sodass ich das Programm nicht immer umprogramieren muss?
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19346
Erhaltene Danke: 1754

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Di 29.04.08 15:57 
1. 13
2. Delphi nicht, aber dein Programm mit entsprechendem Delphi-Quelltext :P, den Quelltext um ein Fenster zu finden, kann dir dieses Programm automatisch generieren:
www.delphi-forum.de/viewtopic.php?t=21271
amazing Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 32



BeitragVerfasst: Fr 09.05.08 21:40 
Ok hab das jetzt Mal gemacht, aber er sagt 'FlashControl' ist unbekannt. Kann das an der Version liegen? aslo ich hab Delphi 4.
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19346
Erhaltene Danke: 1754

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Fr 09.05.08 22:02 
Wie sieht denn der Quelltext aus?
amazing Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 32



BeitragVerfasst: Fr 09.05.08 22:11 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
var
  wndMain, wndChild: HWND;
begin
  wndMain := FindWindow('SunAwtFrame','Channel: 8-Ball,  Nick: Rayen10');
  if wndMain <> 0 then
  begin
    wndChild := FindWindowEx(wndMain, 0, 'SunAwtCanvas', nil);
    wndChild := FindWindowEx(wndChild, 0, 'Edit', nil);
    if wndChild <> 0 then
    begin
      ShowMessage('Window Handle: ' + IntToStr(wndChild));
      FlashControl(wndChild); // internal function
    end;
  end;


Moderiert von user profile iconNarses: Code- durch Delphi-Tags ersetzt
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19346
Erhaltene Danke: 1754

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Fr 09.05.08 23:33 
Das ist doch nur ein Beispielaufruf mit dem gefundenen Handle :lol: .
Das bewirkt in dem Skript dann, dass das Control blinkt. Du musst mit dem Handle eben das machen, was du möchtest. ;-)
amazing Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 32



BeitragVerfasst: Sa 10.05.08 12:32 
Sorry für die vielen Fragen, aber eine hab ich noch ;)
Und zwar hab ich ja jetzt ein ganz bestimmtes Fenster, ich hätte es aber gerne, dass er das aktuell aktivierte nimmt.
toms
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1099
Erhaltene Danke: 2



BeitragVerfasst: So 11.05.08 08:09 
GetForegroundWindow liefert dir das Handle vom Fenster im Vordergrund.