为什么只看见delphi编辑框中的*号的内容????(50分)

  • 主题发起人 主题发起人 windows.net
  • 开始时间 开始时间
W

windows.net

Unregistered / Unconfirmed
GUEST, unregistred user!
下面的代码是用来查看编辑框中*号的内容,为什么只看见delphi编译后的内容,其他的编辑框<br>中的内容就看不见??????<br><br>unit MainFrm;<br><br>interface<br><br>uses<br>&nbsp; Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,<br>&nbsp; StdCtrls, ExtCtrls, SUIURLLabel;<br><br>type<br>&nbsp; TMainForm = class(TForm)<br>&nbsp; &nbsp; GroupBox1: TGroupBox;<br>&nbsp; &nbsp; Label1: TLabel;<br>&nbsp; &nbsp; Label2: TLabel;<br>&nbsp; &nbsp; Label3: TLabel;<br>&nbsp; &nbsp; HandleEdit: TEdit;<br>&nbsp; &nbsp; ClassEdit: TEdit;<br>&nbsp; &nbsp; TextEdit: TEdit;<br>&nbsp; &nbsp; OnTopCheckBox: TCheckBox;<br>&nbsp; &nbsp; Timer: TTimer;<br>&nbsp; &nbsp; suiURLLabel1: TsuiURLLabel;<br>&nbsp; &nbsp; procedure FormCreate(Sender: TObject);<br>&nbsp; &nbsp; procedure TimerTimer(Sender: TObject);<br>&nbsp; &nbsp; procedure OnTopCheckBoxClick(Sender: TObject);<br>&nbsp; private<br>&nbsp; &nbsp; { Private declarations }<br>&nbsp; public<br>&nbsp; &nbsp; { Public declarations }<br>&nbsp; end;<br><br>var<br>&nbsp; MainForm: TMainForm;<br><br>implementation<br><br>{$R *.DFM}<br><br>function GetWorkAreaRect: TRect;<br>begin<br>&nbsp; SystemParametersInfo(SPI_GETWORKAREA, 0, @Result, 0);<br>end;<br><br>procedure SetStayOnTop(Form: TForm; Value: Boolean);<br>begin<br>&nbsp; if Value Then<br>&nbsp; &nbsp; SetWindowPos(Form.Handle, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE)<br>&nbsp; else<br>&nbsp; &nbsp; SetWindowPos(Form.Handle, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE);<br>end;<br><br>procedure TMainForm.FormCreate(Sender: TObject);<br>var<br>&nbsp; R: TRect;<br>begin<br>&nbsp; R := GetWorkAreaRect;<br>&nbsp; Left := R.Right - Width;<br>&nbsp; Top := R.Bottom - Height;<br>&nbsp; SetStayOnTop(Self, True);<br>end;<br><br>procedure TMainForm.TimerTimer(Sender: TObject);<br>var<br>&nbsp; Pos: TPoint;<br>&nbsp; Handle: HWND;<br>&nbsp; Buf: array[0..1024] of Char;<br>&nbsp; msg:string;<br>begin<br>&nbsp; GetCursorPos(Pos);<br>&nbsp; Handle := WindowFromPoint(Pos);<br>&nbsp; HandleEdit.Text := IntToStr(Handle);<br>&nbsp; GetClassName(Handle, Buf, 1024);<br>&nbsp; ClassEdit.Text := Buf;<br>&nbsp; SendMessage(Handle, WM_GETTEXT, 1024, Integer(@Buf));<br>&nbsp; //msg:=inttostr(SendMessage(Handle, WM_GETTEXT, 1024, Integer(@Buf))) ;<br>&nbsp; TextEdit.Text := Buf;<br>&nbsp; //textedit.text:=msg;<br>end;<br><br>procedure TMainForm.OnTopCheckBoxClick(Sender: TObject);<br>begin<br>&nbsp; SetStayOnTop(Self, OnTopCheckBox.Checked);<br>end;<br><br>end.<br>
 
WM_GETTEXT<br>98下可以<br>NT下是不能跨进程的!<br>可以用HOOK的方法插入其他进程.
 
没有看源码,*本来就是不让别人看
 
lmeiing:<br>&nbsp; &nbsp;这段程序是用来看编辑框中的*号的,通过获取对话框的句柄和缓冲区中的文本来看的.<br>wolaixue<br>&nbsp; &nbsp;我试过,在用delphi编译过的程序中有edit类的就可以查看,但是如果是微软的edit类就看不见了<br>只有类名称,
 
下面这个贴子里有我的源码下载(bckj.zip里的HOOK目录):<br>http://www.delphibbs.com/delphibbs/dispq.asp?lid=1862254<br>
 
还是你厉害,希望有机会多向你学习
 
后退
顶部