我怎样知道另一个应用程序的控件变量名?我已经知道这个控件的句柄。

解决方案 »

  1.   

    如果被监控的软件是你自己做的,那么有一个很简单的方法就是通过注册表来写入,然后监控软件读取
    注册表的数据,或者是写入文件也可以。还可以通过收发消息的方式(如果有网卡的话。)或者用API控制发送消息也可。
      

  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 GetWindowTextLength Lib "user32" Alias "GetWindowTextLengthA" (ByVal hwnd As Long) As Long    Dim MyStr As String
        'Create a buffer
        MyStr = String(GetWindowTextLength(hWnd) + 1, Chr$(0))
        'Get the window's text
        GetWindowText Me.hwnd, MyStr, Len(MyStr)
        MsgBox MyStr
      

  3.   

    不是我们自己写的程序,GetWindowText只是获得控件的text或caption的内容,我要的是控件Name
      

  4.   

    控件的Name是不可能知道的,在编译后所有的Name都变成地址了。你看看汇编语言中有变量么?