Solved

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

Posted on 1998-04-20
7
356 Views
Last Modified: 2010-08-05
How to get a text of an Edit control in another application.
0
Comment
Question by:ndthang
[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
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
Technology Partners: 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!

 
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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

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…
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…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Suggested Courses
Course of the Month5 days, 5 hours left to enroll

636 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