[VB6] 網頁抓字
這個function真的很神奇
我雖然看不太懂
不過真的可以將網頁的內容抓下來
'
' IEDOMFromhWnd
'
' Returns the IHTMLDocument interface from a WebBrowser window
'
' hWnd - Window handle of the control
'
'
Type UUID
Data1 As Long
Data2 As Integer
Data3 As Integer
Data4(0 To 7) As Byte
End Type
Function IEDOMFromhWnd(ByVal hWnd As Long) As IHTMLDocument
Dim IID_IHTMLDocument As UUID
Dim hWndChild As Long
Dim spDoc As IUnknown
Dim lRes As Long
Dim lMsg As Long
Dim hr As Long
If hWnd <> 0 Then
If Not IsIEServerWindow(hWnd) Then
' Get 1st child IE server window
EnumChildWindows hWnd, AddressOf EnumChildProc, hWnd
End If
If hWnd <> 0 Then
' Register the message
lMsg = RegisterWindowMessage("WM_HTML_GETOBJECT")
' Get the object
Call SendMessageTimeout(hWnd, lMsg, 0, 0, _
SMTO_ABORTIFHUNG, 1000, lRes)
If lRes Then
' Initialize the interface ID
With IID_IHTMLDocument
.Data1 = &H626FC520
.Data2 = &HA41E
.Data3 = &H11CF
.Data4(0) = &HA7
.Data4(1) = &H31
.Data4(2) = &H0
.Data4(3) = &HA0
.Data4(4) = &HC9
.Data4(5) = &H8
.Data4(6) = &H26
.Data4(7) = &H37
End With
' Get the object from lRes
hr = ObjectFromLresult(lRes, IID_IHTMLDocument, 0, IEDOMFromhWn
d)
End If
End If
End If
End Function
有版友知道為什麼要定義成這樣嗎?
.Data1 = &H626FC520
.Data2 = &HA41E
.Data3 = &H11CF
.Data4(0) = &HA7
.Data4(1) = &H31
.Data4(2) = &H0
.Data4(3) = &HA0
.Data4(4) = &HC9
.Data4(5) = &H8
.Data4(6) = &H26
.Data4(7) = &H37
如果把
.Dara* = &H????
.Data*(*) = &H??
問號?的地方亂改別的16進制會怎麼樣?
我在網路找了將近十個有用UUID的CODE
但每組都是同樣的CODE
到底有什麼特別意義阿?
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 218.160.248.200
→
07/23 09:15, , 1F
07/23 09:15, 1F
→
07/23 14:10, , 2F
07/23 14:10, 2F
※ 編輯: saininniang 來自: 218.160.248.200 (07/23 17:41)
→
07/23 19:42, , 3F
07/23 19:42, 3F
→
07/23 19:43, , 4F
07/23 19:43, 4F
→
07/23 23:56, , 5F
07/23 23:56, 5F
→
07/24 00:59, , 6F
07/24 00:59, 6F
Visual_Basic 近期熱門文章
PTT數位生活區 即時熱門文章