Einzelnen Beitrag anzeigen

Razor
(Gast)

n/a Beiträge
 
#1

Change text of other App Edit Control

  Alt 4. Okt 2009, 11:57
Hi!

I want to change/insert text to a Tedit control of other application ( Find File Dialog ).
I got this so far but i guess Setwindowtext won't work


Delphi-Quellcode:
procedure TForm1.FormCreate(Sender: TObject);
var
  wndMain, wndChild: HWND;
begin
  wndMain := FindWindow('CabinetWClass','Search Results');
  if wndMain <> 0 then
  begin
    wndChild := FindWindowEx(wndMain, 0, 'WorkerW', nil);
    wndChild := FindWindowEx(wndChild, 0, 'ReBarWindow32', nil);
    wndChild := FindWindowEx(wndChild, 0, 'UniversalSearchBand', nil);
    wndChild := FindWindowEx(wndChild, 0, 'Search Box', nil);
 wndChild := FindWindowEx(wndChild, 0, 'SearchEditBoxWrapperClass', nil);
  // WINDOWS.SetWindowTextA(wndchild,'s');
     //WINDOWS.SetWindowTextW(wndchild,'s');
     sendmessage(wndchild,WM_settext,0,0);
    if wndChild <> 0 then
    begin
      ShowMessage('Window Handle: ' + IntToStr(wndChild));

    end;
  end;
end;