Solved

findwindowex and text sending and receiving

Posted on 2000-03-17
3
320 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
Comment Utility
Adjusted points from 20 to 30
0
 
LVL 17

Accepted Solution

by:
inthe earned 30 total points
Comment Utility
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
Comment Utility
thanks very much for you help, the example will help me a lot i reckon.
0

Featured Post

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

Join & Write a Comment

Suggested Solutions

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
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 this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

763 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

11 Experts available now in Live!

Get 1:1 Help Now