Solved

findwindowex and text sending and receiving

Posted on 2000-03-17
3
321 Views
Last Modified: 2010-04-04
I want to make a program that takes text out of an editbox of a completely seperate application. ie. a Name field.

I also wish to modify this text (or complelty change it) and put this new text back into this other applications edit box.

How do i go about doing this.

Please note, i only have Delphi 4 Standard which means i don't have WinSight.

Thanks in advance.

Andrew

I will raise the points shortly when i get more.
0
Comment
Question by:frangers99
  • 2
3 Comments
 

Author Comment

by:frangers99
ID: 2630566
Adjusted points from 20 to 30
0
 
LVL 17

Accepted Solution

by:
inthe earned 30 total points
ID: 2630658
hi,
you dont need winsight cause there another program you can use called sinfo:
http://lcpx07.lc.ehu.es/JMA/win95.html 
(sinfo is very useful utility that i really recommend)
use sinfo to get the class names
then you can do like so:

Function ReadFromNotepad:string;
var h:hwnd;
    Text:string;
    NumCaracters:integer;
begin
h:=FindWindow('notepad',nil);
h:=FindWindowex(h,0,'edit',nil);
if h<>0 then begin
             NumCaracters:=SendMessage(h,wm_getTextLength,0,0);
             setlength(text,NumCaracters);
             SendMessage(h,wm_getText,NumCaracters+1,Integer(text));
             result:=text;
             end
        else result:='ERROR!';
end;

Procedure WriteToNotepad(what:string);
var h:hwnd;
begin
h:=FindWindow('notepad',nil);
h:=FindWindowex(h,0,'edit',nil);
if h<>0 then SendMessage(h,wm_setText,0,Integer(what))
        else showmessage('Error writing to notepad!');
end;
0
 

Author Comment

by:frangers99
ID: 2630681
thanks very much for you help, the example will help me a lot i reckon.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
Concerto provides fully managed cloud services and the expertise to provide an easy and reliable route to the cloud. Our best-in-class solutions help you address the toughest IT challenges, find new efficiencies and deliver the best application expe…

930 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

9 Experts available now in Live!

Get 1:1 Help Now