Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Sendig a string to another EditBox of another App

Posted on 1998-12-02
8
Medium Priority
?
171 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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 600 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
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…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

596 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