Solved

findwindowex and text sending and receiving

Posted on 2000-03-17
3
323 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

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…
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…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

820 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