Private Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
Private Declare Function SetWindowText Lib "user32" Alias "SetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String) As Long
Private Sub Form_Activate()
    'KPD-Team 1998
    'URL: http://www.allapi.net/
    'E-Mail: [email protected]
    Dim MyStr As String
    'Create a buffer
    MyStr = String(100, Chr$(0))
    'Get the windowtext
    GetWindowText Me.hwnd, MyStr, 100
    'strip the rest of buffer
    MyStr = Left$(MyStr, InStr(MyStr, Chr$(0)) - 1)
    'Triple the window's text
    MyStr = MyStr + MyStr + MyStr
    'Set the new window text
    SetWindowText Me.hwnd, MyStr
End Sub

解决方案 »

  1.   

    对于密码框应先
    SendMessage(myHwnd, EM_SETPASSWORDCHAR, 0, 0)
      

  2.   

    EM_SETPASSWORDCHAR 等于多少?
      

  3.   

    dim buf as string
    buf=space(256)
    sendmessage hwnd,WM_GETTEXT,255,byval buf
    buf=left(buf,instr(buf,chr(0))-1)deubg.print buf这样应该没问题!你再试试
      

  4.   

    我说,你是不是 HWND有问题?我刚试了,完全正确!注意是textbox的句柄!Private Function T(ByVal h As Long) As String
        Dim buf As String
        buf = Space(256)
        SendMessage h, WM_GETTEXT, 255, ByVal buf
        buf = Left(buf, InStr(buf, Chr(0)) - 1)
        T = buf
        Debug.Print buf
    End Function
      

  5.   

    Option Explicit
    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 Const WM_GETTEXT = &HDPrivate Function T(ByVal h As Long) As String
        Dim buf As String
        buf = Space(256)
        SendMessage h, WM_GETTEXT, 255, ByVal buf
        buf = Left(buf, InStr(buf, Chr(0)) - 1)
        Debug.Print buf
    End Function
      

  6.   

    Public Const EM_SETPASSWORDCHAR = &HCC
      

  7.   

    这个方法在Win 2000下会没有作用只有用做个Dll然后Hook到QQ中才行
      

  8.   

    同意40Star(陪你去看--☆流星雨★)
    对!Win2K对密码方面做了特殊保护,除非同一进程,否则拒绝执行WM_GETTEXT获取密码框文本。你是用2K吧?
      

  9.   

    to: 40Star(陪你去看--☆流星雨★) 
    不会吧。我用的是XP
    那不是更不行
    你有这方面的源程序吗?
    能发一个给我研究一下吗?
    email:[email protected]
      

  10.   

    to: Chice_wxg(我怕谁?我是谁!我是流氓我最贼。) 
    高手
    你会编Hook吗?
    给个源码地址让我下载研究研究
    或发个到我信箱吧
    还有
    能不能留个QQ MSN什么的联系方式
    最近我的每张帖你都回过
    很想和你交个朋友
      

  11.   

    http://nomey.myetang.com/hook.zip我用Delphi写的简单的HOOK,只挂上,什么都没做。联系可以找:QQ 314917
    [email protected]不过最近要外出,可能没时间