W
windows.net
Unregistered / Unconfirmed
GUEST, unregistred user!
下面的代码是用来查看编辑框中*号的内容,为什么只看见delphi编译后的内容,其他的编辑框<br>中的内容就看不见??????<br><br>unit MainFrm;<br><br>interface<br><br>uses<br> Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,<br> StdCtrls, ExtCtrls, SUIURLLabel;<br><br>type<br> TMainForm = class(TForm)<br> GroupBox1: TGroupBox;<br> Label1: TLabel;<br> Label2: TLabel;<br> Label3: TLabel;<br> HandleEdit: TEdit;<br> ClassEdit: TEdit;<br> TextEdit: TEdit;<br> OnTopCheckBox: TCheckBox;<br> Timer: TTimer;<br> suiURLLabel1: TsuiURLLabel;<br> procedure FormCreate(Sender: TObject);<br> procedure TimerTimer(Sender: TObject);<br> procedure OnTopCheckBoxClick(Sender: TObject);<br> private<br> { Private declarations }<br> public<br> { Public declarations }<br> end;<br><br>var<br> MainForm: TMainForm;<br><br>implementation<br><br>{$R *.DFM}<br><br>function GetWorkAreaRect: TRect;<br>begin<br> SystemParametersInfo(SPI_GETWORKAREA, 0, @Result, 0);<br>end;<br><br>procedure SetStayOnTop(Form: TForm; Value: Boolean);<br>begin<br> if Value Then<br> SetWindowPos(Form.Handle, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE)<br> else<br> 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> R: TRect;<br>begin<br> R := GetWorkAreaRect;<br> Left := R.Right - Width;<br> Top := R.Bottom - Height;<br> SetStayOnTop(Self, True);<br>end;<br><br>procedure TMainForm.TimerTimer(Sender: TObject);<br>var<br> Pos: TPoint;<br> Handle: HWND;<br> Buf: array[0..1024] of Char;<br> msg:string;<br>begin<br> GetCursorPos(Pos);<br> Handle := WindowFromPoint(Pos);<br> HandleEdit.Text := IntToStr(Handle);<br> GetClassName(Handle, Buf, 1024);<br> ClassEdit.Text := Buf;<br> SendMessage(Handle, WM_GETTEXT, 1024, Integer(@Buf));<br> //msg:=inttostr(SendMessage(Handle, WM_GETTEXT, 1024, Integer(@Buf))) ;<br> TextEdit.Text := Buf;<br> //textedit.text:=msg;<br>end;<br><br>procedure TMainForm.OnTopCheckBoxClick(Sender: TObject);<br>begin<br> SetStayOnTop(Self, OnTopCheckBox.Checked);<br>end;<br><br>end.<br>