RT 我有很多个FORM 我能拿到他们的句柄!我想操作每个FORM里面的TEXTBOX 怎么写代码

解决方案 »

  1.   

    FORM的句柄都能拿到,试试TEXTBOX的句柄能不能拿到??如果对方加了密呢... 
      

  2.   

    没有加密我技术差。。就是不知道怎么操作才能拿到form里面控件的句柄。。然后在通过这个句柄操作这个控件。 希望谁能贴个代码出来。。最好有注释 小弟我先谢谢各位大哥大姐了
      

  3.   


    Private Sub Form_Load()
        Dim objForm  As Form
        Dim objCtrl  As Control
        
        '
        ' 获取窗体对象
        '
        Set objForm = GetForm(hWnd)
        
        If Not objForm Is Nothing Then
            '
            ' 遍历窗体控件集合
            '
            For Each objCtrl In objForm.Controls
                '
                ' 控件为编辑框类型,输出控件名称和编辑框内容
                '
                If TypeOf objCtrl Is TextBox Then
                    Debug.Print "TextBox Name: " & objCtrl.Name & " Text: " & objCtrl.Text
                End If
            Next
        End If
    End Sub'
    ' 依据窗体句柄返回 form对象
    '
    Private Function GetForm(ByVal wndHandle As Long) As Form
        Dim frm As Form
        
        For Each frm In Forms
            If frm.hWnd = wndHandle Then
                Set GetForm = frm
                Exit Function
            End If
        Next
    End Function
      

  4.   

    进程内存的使用Controls集合对象,进程外的使用FindWindowEx API。