1. 2009. 11. 8. 02:20 프로그래밍 언어/Basic
Public Declare Function FindWindowEx Lib "user32.dll" Alias "FindWindowExW" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Public Declare Function GetWindowText Lib "user32.dll" Alias "GetWindowTextW" (ByVal hWnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
Public Declare Function GetWindowTextLength Lib "user32.dll" Alias "GetWindowTextLengthW" (ByVal hWnd As Long) As Long
Public Declare Function GetClassName Lib "user32.dll" Alias "GetClassNameW" (ByVal hWnd As Long, ByVal lpClassName As String, ByVal nMaxCount As Long) As Long

Dim Window As String * 255, Class As String * 255
Dim Scn_hWnd As Long, Scn_hWnd2 As Long
GetWindowText Me.hWnd, Window, 255&
GetClassName Me.hWnd, Class, 255&
Scn_hWnd = FindWindowEx(Me.hWnd, 0&, vbNullString, vbNullString)
Do While Scn_hWnd GetWindowText Scn_hWnd, Window, 255&
GetClassName Scn_hWnd, Class, 255&
Scn_hWnd2 = FindWindowEx(Me.hWnd, Scn_hWnd, vbNullString, vbNullString)
If Scn_hWnd2 <> 0& Then
  Scn_hWnd = Scn_hWnd2
else
  Scn_hWnd = FindWindowEx(Scn_hWnd, 0&, vbNullString, vbNullString)
End If
Loop


Private Sub FindWindowPattern(ByRef list As ListBox, ByVal MainhWnd As Long)
Dim hwnd As Long, hWnd2 As Long, wTitle As String * 255
Do
hwnd = FindWindowEx(MainhWnd, hwnd, vbNullString, vbNullString)
If GetWindowText(hwnd, wTitle, 255&) <> 0& Then
  list.AddItem wTitle
End If
hWnd2 = FindWindowEx(hwnd, 0&, vbNullString, vbNullString)
If (hWnd2 And hwnd) <> 0& Then
  FindWindowPattern list, hwnd
End If
Loop While hwnd
End Function


Posted by Nightly Luna
,
® © Tanny Tales
/ rss