找到了哈哈哈.. 取得任何窗口的标题
我给你贴出来.. 窗体上加载个 文本框 和 时控件 并把.interval 属性设置为1
Option Explicit
Private Const WM_GETTEXT = &HD
Private Const EM_SETPASSWORDCHAR = &HCC
Private Const EM_GETPASSWORDCHAR = &HD2
Private Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Type POINTAPI
x As Long
y As Long
End Type
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Declare Function WindowFromPoint Lib "user32" (ByVal xPoint As Long, ByVal yPoint As Long) As Long
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Sub Timer1_Timer()
Dim PassChar As String
Dim PassWord As String
Dim lpPoint As POINTAPI
Dim hMousePWindow As Long
PassWord = String(256, Chr(0))
GetCursorPos lpPoint
hMousePWindow = WindowFromPoint(lpPoint.x, lpPoint.y)
PassChar = SendMessage(hMousePWindow, EM_GETPASSWORDCHAR, 0, 0)
Call PostMessage(hMousePWindow, EM_SETPASSWORDCHAR, 0, 0)
Call Sleep(100)
Call SendMessage(hMousePWindow, WM_GETTEXT, 256, ByVal PassWord)
Call PostMessage(hMousePWindow, EM_SETPASSWORDCHAR, PassChar, 0)
Text1.Text = PassWord
End Sub