AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

FindwindowEx

Ein Thema von ReCoVeR · begonnen am 1. Feb 2004 · letzter Beitrag vom 1. Feb 2004
Antwort Antwort
ReCoVeR

Registriert seit: 1. Feb 2004
4 Beiträge
 
#1

FindwindowEx

  Alt 1. Feb 2004, 19:07
huhu^^ ich will mit FindWindowEx einen string, in ein anderes fenster einfügen, doch in dem anderem fenster gibt es 4x TEdit....

Delphi-Quellcode:
var Handle: HWND;
    Eingabe: string;
begin
  Eingabe := 'alalalala';
  Handle := FindWindow('TForm1', nil);
  Handle := FindWindowEx(Handle,0,TEdit,nil);
  SendMessage(Handle,WM_SETTEXT,0,Integer(Eingabe));
geht dann nich.. weiß wer ne lösung?

Weiß net obs in die Kategorie gehört sorry

thx schonmal

[edit=Luckie]Delphi-Tags eingefügt. Mfg, Luckie[/edit]
  Mit Zitat antworten Zitat
Benutzerbild von Luckie
Luckie

Registriert seit: 29. Mai 2002
37.621 Beiträge
 
Delphi 2006 Professional
 
#2

Re: FindwindowEx

  Alt 1. Feb 2004, 19:19
Steht in dem Edit "TEdit" drin? Btwe. Muss es heißen:
SendMessage(Handle,WM_SETTEXT,0,Integer(@Eingabe[1])); Eine Fehlermeldung wäre auch nicht schlecht.
Michael
Ein Teil meines Codes würde euch verunsichern.
  Mit Zitat antworten Zitat
ReCoVeR

Registriert seit: 1. Feb 2004
4 Beiträge
 
#3

Re: FindwindowEx

  Alt 1. Feb 2004, 19:32
keine fehlermeldung! das isses ja =(
  Mit Zitat antworten Zitat
Benutzerbild von toms
toms
(CodeLib-Manager)

Registriert seit: 10. Jun 2002
4.648 Beiträge
 
Delphi XE Professional
 
#4

Re: FindwindowEx

  Alt 1. Feb 2004, 19:47
Zitat:
ich will mit FindWindowEx einen string, in ein anderes fenster einfügen, doch in dem anderem fenster gibt es 4x TEdit....
Sollte so funktionieren:

Delphi-Quellcode:
function FindControlByNumber(hApp: HWND; ClassName: string; ControlNr: Word = 1): HWND;
var
  i: Word;
  hControl: HWND;
begin
  Result := 0;
  if IsWindow(hApp) then
  begin
    Dec(ControlNr);
    hControl := 0;
    for i := 0 to ControlNr do
    begin
      hControl := FindWindowEx(hApp, hControl, PChar(ClassName), nil);
      if hControl = 0 then
        Exit;
    end;
  end;
  Result := hControl;
end;

procedure SetEditText(hApp: HWND; ClassName, AText: string; EditNr: Integer);
var
  hEdit: HWND;
begin
  hEdit := FindControlByNumber(hApp, ClassName, EditNr);
  if hEdit <> 0 then
    SendMessage(hEdit, WM_SETTEXT, 0, Integer(PChar(AText)));
end;

// dem "4." Edit vom Fenster TForm1 Text senden.
procedure TForm1.Button1Click(Sender: TObject);
begin
  SetEditText(FindWindow('TForm1', nil),'TEdit','alalalala',4);
end;
Thomas
  Mit Zitat antworten Zitat
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 04:57 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz