![]() |
Change text of other App Edit Control
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; |
Re: Change text of other App Edit Control
Hi,
To set the text of a control in another process, send the WM_SETTEXT message directly instead of calling SetWindowText. ![]() |
Re: Change text of other App Edit Control
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; |
Re: Change text of other App Edit Control
What's your OS? Is the message ShowMessage(..) shown?
Also check out ![]() |
Re: Change text of other App Edit Control
WIN 7 rtm 7600
|
Re: Change text of other App Edit Control
Zitat:
|
Re: Change text of other App Edit Control
The snippet dosent seem to work with DElphi 2010.. :)
[DCC Error] Unit1.pas(90): E2010 Incompatible types: 'Char' and 'AnsiChar'
Delphi-Quellcode:
[DCC Warning] Unit1.pas(89): W1002 Symbol 'IncludeTrailingBackslash' is specific to a platform
ExecuteMacro(PChar('[FindFolder(, '+ sVerz +')]'), False);
Delphi-Quellcode:
sVerz := IncludeTrailingBackslash(Verzeichnis);
|
Re: Change text of other App Edit Control
Zitat:
![]() Zitat:
|
Re: Change text of other App Edit Control
Great . now i have to worry about security levels just great.
|
Re: Change text of other App Edit Control
Nobody...?Dont know or is it that almost everybody is lazy to hit the post button.
|
Alle Zeitangaben in WEZ +1. Es ist jetzt 02:36 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz