我VB的初学者如可能请您尽量回答的详细点;万分感谢拉!!!

解决方案 »

  1.   

    Private Declare Function EnumChildWindows Lib "user32" Alias "EnumChildWindows" (ByVal hWndParent As Long, ByVal lpEnumFunc As Long, ByVal lParam As Long) As Long
      

  2.   

    首先用函数Findwindow找到另一个程序的主窗口句柄,然后把找到的句柄作为hWndParent,用EnumChildWindows得到所有的子窗口句柄。
      

  3.   

    非常感谢“laviewpbt(人一定要靠自己) ”&“softbugg() ”两位老师;
    我是菜鸟啊能给个具体的代码吗?“Findwindow”和“EnumChildWindows”怎么用啊?
    “hWndParent”是什么意思啊?
    谢谢拉;555
      

  4.   

    模块中
    Option Explicit
    Declare Function FindWindow Lib "user32.dll" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
    Declare Function EnumChildWindows Lib "user32" (ByVal hWndParent As Long, ByVal lpEnumFunc As Long, ByVal lParam As Long) As LongPublic Function EnumChildProc(ByVal hwnd As Long, ByVal lParam As Long) As Long
    Form1.List1.AddItem hwnd
    EnumChildProc = 1
    End Function窗体中
    Private Sub command2_Click()
    List1.Clear
    Dim twd As Long
    twd = FindWindow(vbNullString, "计算器")   '请打开计算器,
    EnumChildWindows twd, AddressOf EnumChildProc, ByVal 0& 
    End Sub
      

  5.   

    遍历所有窗口用FindWindow
    遍历窗口所有控件用FindWindowEx