Solved

How to get a text of Edit com. in another app.

Posted on 1998-04-20
7
336 Views
Last Modified: 2010-08-05
How to get a text of an Edit control in another application.
0
Comment
Question by:ndthang
7 Comments
 
LVL 5

Expert Comment

by:inter
ID: 1335395
Hi,
There are several methods if you programmed the both appllications. The ways are:
1 - Global memory
2 - With special application messages
3 - With pipes or other IPC mechanism
4 - With directly using files
5 - By using a pseudo registry entry
Regards,
Igor
0
 
LVL 1

Expert Comment

by:pjdb
ID: 1335396
inter,

You did forget the standard application messages (the way you'll have to use if the other application can't be modified).

JDB
0
 
LVL 1

Expert Comment

by:Edo082297
ID: 1335397
Hi Igor

When you say global memory, you do mean memory mapped files, right?

Edo
0
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.

 
LVL 1

Accepted Solution

by:
AndersWP earned 100 total points
ID: 1335398
It seems to me that the simplest way would be to use the WM_GETTEXT message.

No matter what method you choose to get the text, you will need a reference to the source edit control that holds the text you need. If you use the WM_GETTEXT, you will need the windows handle of the source edit control (this corresponds to the Handle property of a Delphi TEdit control).

The following code should do the trick:

Var
  TextBuffer: Array[0..512] of Char;

Begin
  PostMessage(SourceHandle, WM_GETTEXT, Sizeof(TextBuffer)-1,
              TextBuffer);
End;

where SourceHandle is the windows handle to the source edit control. That wasn't so bad, was it?

I hope this will help you.

Greetings,
AndersWP
0
 
LVL 1

Expert Comment

by:pjdb
ID: 1335399
As i've said!

JDB
0
 

Author Comment

by:ndthang
ID: 1335400
Thank you
But .......

SendMessage(SourceHandle, WM_GETTEXT, Sizeof(TextBuffer)-1, Integer(@TextBuffer));

0
 
LVL 1

Expert Comment

by:AndersWP
ID: 1335401
Oops, I forgot the typecasting, but I see you handled that yourself.

One more thing:
As a rule of thumb, always Use PostMessage rather than SendMessage when communicating between applications. For WM_GETTEXT is does not matter, but for messages that generate more messages you can get in some horrible troubles from getting the message loops of the two applications tangled if you use SendMessage.

Greetings,
AndersWP
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

Title # Comments Views Activity
Send message from delphi to whatsapp, is it possible? 3 1,680
LAN or WAN ? 11 95
Unique identifier on a terminal server (rdp) 4 67
Delphi: making a BW image transparent 10 61
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…
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…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

832 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