Solved

Sendig a string to another EditBox of another App

Posted on 1998-12-02
8
164 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
ID: 1349021
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
ID: 1349022
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
ID: 1349023
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
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 

Author Comment

by:borgo
ID: 1349024
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
 
LVL 8

Accepted Solution

by:
ZifNab earned 300 total points
ID: 1349025
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
ID: 1349026
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
ID: 1349027
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
ID: 1349028
hi rwilson, thanks for clarification. I wasn't sure about it, like I said.
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
PDF library for Delphi 2 121
Delphi cmd execution 6 60
how to center only a line in richedit? 4 56
How to define IfThen functions in one common unit? 4 50
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

776 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