可用SPY++观察一下桌面窗口层次,用FindWindowEx查找相应窗口

解决方案 »

  1.   

    Public Declare Function GetDesktopWindow Lib "user32" Alias "GetDesktopWindow" () As Long
    自己人也要给分,大不了8折
      

  2.   

    Progman
       |
        ------SHELLDLL_DefView
                   |
                    ------SysListView32
      

  3.   

    '**********************************
    '**  Function Declarations:#If Win32 Then
    Private Declare Function FindWindowEx& Lib "user32" Alias "FindWindowExA" (ByVal hWndParent As Long, ByVal hWndChildAfter As Long, ByVal lpClassName As String, ByVal lpWindowName As String)
    #End If 'WIN32Private Sub Form_DblClick()
        Dim hWnd As Long
        hWnd = FindWindowEx(0, 0, "Progman", "Program Manager")
        hWnd = FindWindowEx(hWnd, 0, "SHELLDLL_DefView", vbNullString)
        hWnd = FindWindowEx(hWnd, 0, "SysListView32", vbNullString)
        Debug.Print Hex$(hWnd)
    End Sub
      

  4.   

    Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
    Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
    Dim tWnd As Long, bWnd As Long, cWnd As LongPrivate Sub Form_Load()
        tWnd = FindWindow("Progman", vbNullString)
        bWnd = FindWindowEx(tWnd, ByVal 0&, "SHELLDLL_DefView", vbNullString)
        cWnd = FindWindowEx(bWnd, ByVal 0&, "SysListView32", vbNullString)
        Me.Caption = cWnd
    End Sub