作者saininniang (莎里奈)
看板Visual_Basic
标题[VB6] 为什麽网页抓字要用到UUID
时间Wed Jul 23 06:03:20 2008
这个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
1F:→ MOONRAKER:那是UUID,就是通常写成registry key的那一些东西 07/23 09:15
2F:→ saininniang:为什麽要用到UUID,不是只是单纯抓字下来吗? 07/23 14:10
※ 编辑: saininniang 来自: 218.160.248.200 (07/23 17:41)
3F:→ MOONRAKER:「代志不是憨人所想的这麽简单」(铁狮玉玲珑调) 07/23 19:42
4F:→ MOONRAKER:UUID是用来呼叫COM的,程式那麽短自己要看得懂 07/23 19:43
5F:→ saininniang:其实我真的不懂..0rz 看了好几遍code了 07/23 23:56
6F:→ mrhihi:先搞懂ObjectFromLresult吧 07/24 00:59