看板 Visual_Basic 關於我們 聯絡資訊
這個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
MOONRAKER:那是UUID,就是通常寫成registry key的那一些東西 07/23 09:15
saininniang:為什麼要用到UUID,不是只是單純抓字下來嗎? 07/23 14:10
※ 編輯: saininniang 來自: 218.160.248.200 (07/23 17:41)
MOONRAKER:「代誌不是憨人所想的這麼簡單」(鐵獅玉玲瓏調) 07/23 19:42
MOONRAKER:UUID是用來呼叫COM的,程式那麼短自己要看得懂 07/23 19:43
saininniang:其實我真的不懂..0rz 看了好幾遍code了 07/23 23:56
mrhihi:先搞懂ObjectFromLresult吧 07/24 00:59