Articles   Members Online: 3
-Article/Tip Search
-News Group Search over 21 Million news group articles.
-Delphi/Pascal
-CBuilder/C++
-C#Builder/C#
-JBuilder/Java
-Kylix
Member Area
-Home
-Account Center
-Top 10 NEW!!
-Submit Article/Tip
-Forums Upgraded!!
-My Articles
-Edit Information
-Login/Logout
-Become a Member
-Why sign up!
-Newsletter
-Chat Online!
-Indexes NEW!!
Employment
-Build your resume
-Find a job
-Post a job
-Resume Search
Contacts
-Contacts
-Feedbacks
-Link to us
-Privacy/Disclaimer
Embarcadero
Visit Embarcadero
Embarcadero Community
JEDI
Links
Read out Edit / EditBox from another application even if it says: "*****" Turn on/off line numbers in source code. Switch to Orginial background IDE or DSP color Comment or reply to this aritlce/tip for discussion. Bookmark this article to my favorite article(s). Print this article
18-Oct-02
Category
VCL-General
Language
Delphi 5.x
Views
112
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Maarten de Haan

How to read out Edit / EditBox from another application even if it says: "*****"

Answer:

1   unit
2     Unit1;
3   
4   interface
5   
6   uses
7     Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
8     Dialogs, ExtCtrls, StdCtrls, ComCtrls;
9   
10  type
11    TForm1 = class(TForm)
12      Timer1: TTimer;
13      Panel1: TPanel;
14      StatusBar1: TStatusBar;
15      // Procedures
16      procedure FormCreate(Sender: TObject);
17      procedure Timer1Timer(Sender: TObject);
18      procedure FormClose(Sender: TObject; var Action: TCloseAction);
19  
20    private
21      { Private declarations }
22    public
23      { Public declarations }
24    end;
25  
26  var
27    Form1: TForm1;
28    bQuit: Boolean;
29  
30  implementation
31  
32  {$R *.DFM}
33  
34  //--------------------------------------------------------------------
35  
36  procedure TForm1.FormCreate(Sender: TObject);
37  
38  begin
39    // Init Bo
40    bQuit := False;
41  
42    // Init timer
43    Timer1.Interval := 250;
44    Timer1.Enabled := True;
45  
46  end;
47  //--------------------------------------------------------------------
48  procedure TForm1.Timer1Timer(Sender: TObject);
49  
50  var
51    pP: TPoint;
52    iX, iY: Integer;
53    iOldX, iOldY: Integer;
54    iL: Integer;
55    aBuf: array[0..255] of Char;
56    hH, hOldH: THandle;
57    hH1: Thandle;
58  
59  begin
60    // Timer off
61    Timer1.Enabled := False;
62    iOldX := 0;
63    iOldY := 0;
64    hOldH := 0;
65    repeat
66      // Let windows do his job(s)
67      Application.ProcessMessages;
68      // Get position of cursor on screen
69      GetCursorPos(pP);
70      // Convert to X and Y value
71      iX := pP.x;
72      iY := pP.y;
73      // Get the handle of the component under the cursor
74      hH := WindowFromPoint(pP);
75      // Get the handle of the child (if any)
76      hH1 := ChildWindowFromPoint(hH, pP);
77      if hH1 <> 0 then
78        hH := hH1;
79  
80      if (iOldX <> iX) or (iOldY <> iY) then
81        if hH <> hOldH then
82        begin
83          if hH <> Panel1.Handle then
84          begin
85            GetClassName(hH, aBuf, SizeOf(aBuf));
86            Form1.Panel1.Caption := 'Class: ' + StrPas(aBuf);
87            // Show the classname in the label
88            iL := SendMessage(hH, WM_GETTEXT, SizeOf(aBuf), longint(@aBuf));
89            // If length of line > 0 then show the line in the Label
90            if iL > 0 then
91              Panel1.Caption := 'Text: "' + StrPas(aBuf) + '"';
92          end
93          else
94            Panel1.Caption := 'Get me the password!';
95  
96          // Save old x, y, h values
97          hOldH := hH;
98          iOldX := iX;
99          iOldY := iY;
100       end;
101   until bQuit;
102 end;
103 //--------------------------------------------------------------------
104 
105 procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
106 
107 begin
108   // Quit the repeat loop on close
109   bQuit := True;
110 end;
111 //--------------------------------------------------------------------
112 end.
113 //====================================================================


			
Vote: How useful do you find this Article/Tip?
Bad Excellent
1 2 3 4 5 6 7 8 9 10

 

Advertisement
Share this page
Advertisement
Download from Google

Copyright © Mendozi Enterprises LLC