[問題] VB.NET EnumChildWindows列舉物件

看板Programming作者 (EddieSu)時間13年前 (2012/09/21 00:23), 編輯推噓0(002)
留言2則, 1人參與, 最新討論串1/1
各位先進, 小弟東拼西湊,做中學,現在實在來不及了,所以斗膽上來請益 ^^b 現在手上有這二個function,能請高手幫寫一個function,傳入hwnd,傳回該視窗所有物件的arraylist ============================================================================ Private Function GetWindowIdentification(ByVal hwnd As Long, ByRef sIDType As String, ByRef sClass As StringBuilder) As String Dim nSize As Long Dim sTitle As New StringBuilder("", 256) 'get the size of the string required 'to hold the window title Dim sClassName As New StringBuilder("", 256) 'pass in the handle of the object for which to get 'the class name; for example, the form's handle nSize = GetWindowTextLength(hwnd) 'if the return is 0, there is no title If nSize > 0 Then Dim ay As New Rectangle GetWindowRect(hwnd, ay) 'MsgBox(Me.PointToClient(ay.Location).ToString) GetWindowText(hwnd, sTitle, 256) 'Call GetClassName(hwnd, sTitle, 256) 'no title, so get the class name instead Call GetClassName(hwnd, sClass, 256) sIDType = "class & name" End If Return Trim(sTitle.ToString) End Function Public Function EnumChildProc(ByVal hwnd As IntPtr, ByRef lParam As IntPtr) As Integer 'working vars Dim sTitle As String Dim sClass As New StringBuilder(100000) Dim sIDType As String = "" 'get the window title / class name sTitle = GetWindowIdentification(hwnd, sIDType, sClass) 'add to the listview MsgBox(sTitle & sClass.ToString) ' Listview_IndentItem(.hwnd, CLng(itmX.Index), 1) EnumChildProc = 1 End Function -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 42.73.24.154

09/21 01:28, , 1F
參考看看這個: http://ppt.cc/f13o
09/21 01:28, 1F

09/22 00:25, , 2F
文章代碼(AID): #1GMqCQJm (Programming)
文章代碼(AID): #1GMqCQJm (Programming)