在BCB,DLPHI中怎样看*****中的确内容?(100分)

  • 主题发起人 主题发起人 Kaven
  • 开始时间 开始时间
K

Kaven

Unregistered / Unconfirmed
GUEST, unregistred user!
在BCB,DLPHI中怎样看*****中的确内容?指看内存中的,不是PWL中的.象GETIP,PASSVIEW,PWLVIEW.最好用BCB.Thank you!
 
sendmessage(the_edit_control.handle, WM_GETTEXT, count, buffer );
 
补充一点,直接的‘*****’是没有意义的,因而可通过消息等来获取。
 
*****只是显示出来是这样, 其实根本就是个tedit, 所以可以用wm_gettext得到.<br>不过, 有些程序用了其它的方法, 如nt的domainusermanager就不能通过这个方法<br>得到密码:-(<br>
 
感谢个位高手指点!!!<br>但是怎样才能获得 the_edit_control.handle 这个焦点。<br>
 
类似的软件都必须通过鼠标指点一个edit来进行处理, 所以可以通过<br>WindowAtPoint(名字实在记不住了!) API函数来得到edit的句柄.
 
如果是你自己的程序, 那么直接用getfocus就能得到handle<br>如果是别人正在运行的程序, 那么可能麻烦点. <br>我的方法是:<br>getforegroundwindow取得别人的窗口handle, getwindowthreadprocessid取得<br>别人窗口的thread句柄.<br>getcurrentthreadid取得自己程序的threadid,<br>attachthread将自己的thread加到别人thread后.<br>getfocus取得别人窗口中当前的edit的handle.<br>再次调用attchthread取消attach.<br>postmessage
 
另一个方法是enumchildwindows, 根据返回的hwnd用getwindowlong取得<br>该window的style, 判断是否ES_PASSWORD置位了, 如果是, 那么这个<br>hwnd就是您需要的edit的hwnd了
 
查到了, 是 WindowFromPoint 这个函数!
 
不过有时出access violet错误:-)<br><br>var<br>&nbsp; name:pchar;<br>&nbsp; l:integer;<br>&nbsp; hdc:hwnd;<br>&nbsp; x:tpoint;<br>begin<br>&nbsp; GetCursorPos(x);<br>&nbsp; hdc:=WindowFromPoint(x);<br>&nbsp; l:=255;<br>&nbsp; if hdc&lt;&gt;0 then<br>&nbsp; begin<br>&nbsp; &nbsp; try<br>&nbsp; &nbsp; l:=SendMessage(hdc,WM_GETTEXTLENGTH,0,0)+1;<br>&nbsp; &nbsp; SendMessage(hdc,wm_gettext,l,longint(name));<br>&nbsp; &nbsp; label1.Caption:=string(name);<br>&nbsp; &nbsp; except<br>&nbsp; &nbsp; label1.Caption:='error';<br><br>&nbsp; &nbsp; end;<br>&nbsp; end;<br><br>end;<br>
 
to cytown: 估计问题在这一句:<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if hdc<>0 then &nbsp;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ^^^WindowFromPoint返回值在不成功时为nil, 并不是<>0
 
cakk, 你错了:-(<br>去实践一下吧:-)<br>
 
确实没试过,只知道这么做可以. 我是看Delphi帮助里说等于nil的. &nbsp;:-)
 
后退
顶部