Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 1998-04-20
7
Medium Priority
?
366 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
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!

 
LVL 1

Accepted Solution

by:
AndersWP earned 300 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: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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

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…
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…
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…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

722 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