Solved

Sendig a string to another EditBox of another App

Posted on 1998-12-02
8
158 Views
Last Modified: 2010-04-04
How Can I send a string to an edit box which is inside a window of another application (not one of mine)?
I'd like to automate it.
Thanks and greetings from Italy.
0
Comment
Question by:borgo
8 Comments
 
LVL 44

Expert Comment

by:bruintje
Comment Utility
Hi Borgo,

There are several ways and they depend on how you would implement your application. It can be done via the clipboard, Ole automation or even COM, so please be a bit more specific.

Bruintje.
0
 
LVL 10

Expert Comment

by:viktornet
Comment Utility
YOu can use sendmessage to do that...

here is a sample..

procedure SendStringToApp(Str : string; hEditBox : HWND);
var
  i : integer;
begin
  for i := 1 to Length(Str) do
    SendMessage(hEditBox, WM_CHAR, Ord(Str[i]), 0);
end;

Now you jsut need to get the handle to the edit box and send the message to it :)

SendStringToApp('Hope this helps', HandleToTheEditBox);

If you need more help with finding the handle of an edit box from an app just tell me and I'll try to help ya...

Cheers,
Viktor
0
 
LVL 10

Expert Comment

by:viktornet
Comment Utility
YOu can use GetWindowClass() to check for the class and if it is an edit box then use the SendStringToApp() procedure to send the string to the editbox

Cheers,
Viktor
0
 

Author Comment

by:borgo
Comment Utility
I have a lots of problems. How can I find the right handle among many opened windows ?

Bruintje: I don't know a lots about COM or OLE automation.
So Can you tell me what is the best solution plese?
Do you have any  examples ?
0
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
LVL 8

Accepted Solution

by:
ZifNab earned 300 total points
Comment Utility
Hi borgo,

 I could write down the source here, but once upon a time somebody wrote a freeware component (with source) for this. So I think you can learn a lot from the code in this component. It's really not much! The component was made by Matvey :

http://www.delphipages.com/edit/count.cfm?comID=453&Link=uploads%2FMiscellaneous%2FMUMacro1%2Ezip

But instead of sending the text with the help of sendmessage(..,wm_char, ...)
I propose to try out the function setwindowtext() {I'm only not sure if it also works with Edit components, but you can try}

Regards, Zif.
0
 
LVL 8

Expert Comment

by:ZifNab
Comment Utility
clarification : with the words 'it's really not much' I refer to the size of the code. It's not much code so you don't have to wrestle trough a lot of code.
0
 
LVL 12

Expert Comment

by:rwilson032697
Comment Utility
Hi Zif - I don't think SetWindowText will work as it requires the handle of the control and handles are always interpreted in the context of the calling process.

CXheers,

Raymond.

0
 
LVL 8

Expert Comment

by:ZifNab
Comment Utility
hi rwilson, thanks for clarification. I wasn't sure about it, like I said.
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
This video discusses moving either the default database or any database to a new volume.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now