Solved

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

Posted on 1998-04-20
7
317 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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

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…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

705 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now