Solved

Sendig a string to another EditBox of another App

Posted on 1998-12-02
8
166 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
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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.

 

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

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

Suggested Solutions

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

829 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