Solved

Sendig a string to another EditBox of another App

Posted on 1998-12-02
8
168 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 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

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!

Question has a verified solution.

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…

718 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