为何,消息wm_gettext取不到显示为‘*’的字符串(在win2000中),应该怎样取?(50分)

  • 主题发起人 主题发起人 fu_qi_ming
  • 开始时间 开始时间
F

fu_qi_ming

Unregistered / Unconfirmed
GUEST, unregistred user!
如题,<br>请教。。。
 
先向目标发一个PostMessage,就可以了。<br>PostMessage(hwnd, EM_SETPASSWORDCHAR, longint(0), 0)<br><br>{-------------------------------------------------------------------------------}<br>{系统的回调过程,在本过程内发送显示/隐藏密码的消息}<br>function EnumChildWindowsProc(hwnd: Integer; lparam: Longint): Boolean; stdcall;<br>var<br>&nbsp; buffer: array[0..255] of Char;<br>begin<br>&nbsp; GetClassName(hwnd, buffer, 256);<br>//if StrPas(Buffer) = 'TEdit' then &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;//找TEdit控件<br>&nbsp; begin<br>&nbsp; &nbsp; if lparam = 0 then<br>&nbsp; &nbsp; &nbsp; PostMessage(hwnd, EM_SETPASSWORDCHAR, longint(0), 0)<br>&nbsp; &nbsp; else<br>&nbsp; &nbsp; &nbsp; PostMessage(hwnd, EM_SETPASSWORDCHAR, longint('*'), 0);<br><br>&nbsp; &nbsp; InvalidateRgn(hwnd, 0, True);<br>&nbsp; &nbsp; Result := True; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //终止循环<br>&nbsp; end;<br>end;<br><br>{-------------------------------------------------------------------------------}<br>{显示/隐藏所有窗体密码,本部分枚举所有窗体}<br>procedure ShowAll(lparam: Integer);<br>var<br>&nbsp; Window_Handle, Hand: Integer;<br>begin<br>&nbsp; Window_Handle := GetWindow(Application.Handle, GW_HWNDFIRST);<br>&nbsp; while Window_Handle &lt;&gt; 0 do<br>&nbsp; begin<br>&nbsp; &nbsp; if Window_Handle &lt;&gt; 0 then<br>&nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; EnumChildWindows(Window_Handle, @EnumChildWindowsProc, lparam);<br>&nbsp; &nbsp; end;<br>&nbsp; &nbsp; Window_Handle := GetWindow(Window_Handle, GW_HWNDNEXT);<br>&nbsp; end;<br>end;
 
把文本框的密码属性去掉即可,yzhshi的程序就是这个意思
 
在win2000中,<br>在一个应用程序中是可以,,<br>但是,现在是在不同的应用程序中。。<br>好象不可以。。
 
把密码属性去掉,抓完密码后再加上去即可。我试过,在win2000下同样能抓。
 
要在,不同的应用程序间,,你试过吗,,<br>重要的是不同的应用间
 
是我搞错了,可以实现
 

Similar threads

S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
后退
顶部