如题

解决方案 »

  1.   

    【VB声明】
      Private Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long【别名】
      GetWindowTextA【说明】
      取得一个窗体的标题(caption)文字,或者一个控件的内容(在vb里使用:使用vb窗体或控件的caption或text属性) 【返回值】
      Long,复制到lpString的字串长度;不包括空中止字符。会设置GetLastError 【备注】
      不能用它从另一个应用程序的编辑控件中获取文字【参数表】
      hwnd -----------  Long,欲获取文字的那个窗口的句柄  lpString -------  String,预定义的一个缓冲区,至少有cch+1个字符大小;随同窗口文字载入
      

  2.   

    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
      

  3.   

    或者用sendmessage发送wm_gettext消息
      

  4.   

    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 EM_GETLINE = &HC4
    Dim  Handle  As  Long   
    Dim  ComboText  As  StringComboText  =  Space(255)    
    SendMessage  Handle,  EM_GETLINE,  0,  ByVal  ComboText  
    MsgBox  "Combo中的内容为:"  &  Left(ComboText,  InStr(ComboText,  Chr(0))  -  1)