Solved

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

Posted on 1998-04-20
7
329 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
ScreenConnect 6.0 Free Trial

Discover new time-saving features in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

 
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

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…
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…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

803 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