AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein Win32/Win64 API (native code) Delphi Change text of other App Edit Control
Thema durchsuchen
Ansicht
Themen-Optionen

Change text of other App Edit Control

Ein Thema von Razor · begonnen am 4. Okt 2009 · letzter Beitrag vom 4. Okt 2009
Thema geschlossen
Seite 1 von 3  1 23      
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;
 
Benutzerbild von toms
toms
(CodeLib-Manager)

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

Re: Change text of other App Edit Control

  Alt 4. Okt 2009, 12:06
Hi,

To set the text of a control in another process, send the WM_SETTEXT message directly instead of calling SetWindowText.
MSDN-Library durchsuchenSetWindowText
Thomas
 
Razor
(Gast)

n/a Beiträge
 
#3

Re: Change text of other App Edit Control

  Alt 4. Okt 2009, 12:12
Well clearly its not working toms...I want to specify what i want to search from delphi app to the find file dialog directory is not enough.Thats why this way..

Delphi-Quellcode:
uses ddeman;

procedure TForm1.Button1MouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);

  var
  wndMain, wndChild: HWND;
    msg : String;

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

msg := 'search for this';



    if wndChild <> 0 then
    begin
      ShowMessage('Window Handle: ' + IntToStr(wndChild));
       SendMessage(wndchild, WM_SETTEXT, 0, LongInt(PChar(msg)));

  end;

  end;
end;



procedure TForm1.FormCreate(Sender: TObject);
begin
  with TDDEClientConv.Create(Self) do begin
   ConnectMode := ddeManual;
   ServiceApplication := 'explorer.exe';
   SetLink( 'Folders', 'AppProperties') ;
   OpenLink;
   ExecuteMacro
       ('[FindFolder(, C:\DelphiTips)]', False) ;
   CloseLink;
   Free;
  end;


end;
 
Benutzerbild von toms
toms
(CodeLib-Manager)

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

Re: Change text of other App Edit Control

  Alt 4. Okt 2009, 13:00
What's your OS? Is the message ShowMessage(..) shown?

Also check out http://www.delphi-forum.de/viewtopic.php?p=217770
Thomas
 
Razor
(Gast)

n/a Beiträge
 
#5

Re: Change text of other App Edit Control

  Alt 4. Okt 2009, 13:01
WIN 7 rtm 7600
 
Benutzerbild von toms
toms
(CodeLib-Manager)

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

Re: Change text of other App Edit Control

  Alt 4. Okt 2009, 13:06
Zitat von Razor:
WIN 7 rtm 7600
I asked 2 questions
Thomas
 
Razor
(Gast)

n/a Beiträge
 
#7

Re: Change text of other App Edit Control

  Alt 4. Okt 2009, 13:06
The snippet dosent seem to work with DElphi 2010..

[DCC Error] Unit1.pas(90): E2010 Incompatible types: 'Char' and 'AnsiChar'
 ExecuteMacro(PChar('[FindFolder(, '+ sVerz +')]'), False); [DCC Warning] Unit1.pas(89): W1002 Symbol 'IncludeTrailingBackslash' is specific to a platform
sVerz := IncludeTrailingBackslash(Verzeichnis);
 
Benutzerbild von sx2008
sx2008

Registriert seit: 16. Feb 2008
Ort: Baden-Württemberg
2.332 Beiträge
 
Delphi 2007 Professional
 
#8

Re: Change text of other App Edit Control

  Alt 4. Okt 2009, 13:16
Zitat von Razor:
WIN 7 rtm 7600
http://msdn.microsoft.com/en-us/libr...8VS.85%29.aspx
Zitat von MSDN:
Microsoft Windows Vista and later. Message sending is subject to User Interface Privilege Isolation (UIPI). The thread of a process can send messages only to message queues of threads in processes of lesser or equal integrity level.
fork me on Github
 
Razor
(Gast)

n/a Beiträge
 
#9

Re: Change text of other App Edit Control

  Alt 4. Okt 2009, 13:17
Great . now i have to worry about security levels just great.
 
Razor
(Gast)

n/a Beiträge
 
#10

Re: Change text of other App Edit Control

  Alt 4. Okt 2009, 14:26
Nobody...?Dont know or is it that almost everybody is lazy to hit the post button.
 
Thema geschlossen
Seite 1 von 3  1 23      


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 02:48 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