请问有没有比inet控件更快得到网页源文件的方法:dim content as string
Inet1.url="www.sohu.com"
content = Inet1.OpenURL(Inet1.url)
msgbox content请各位指点
感谢感谢~
Inet1.url="www.sohu.com"
content = Inet1.OpenURL(Inet1.url)
msgbox content请各位指点
感谢感谢~
Inet1.url="www.sohu.com"
content = Inet1.OpenURL(Inet1.url)
msgbox content请各位指点
感谢感谢~
加入timer,commandbutton,text
private sub command1_click()
webbrowser1.navigate http://www.sohu.com/
timer1.enabled=true
end subprivate sub timer1_timer()
dim doc,objhtml as object
dim i as integer
dim strhtml as stringif not webbrowser1.busy then
set doc=webbrowser1.document
i=0
set objhtml=doc.body.createtextrange()
if not isnull(objhtml) then
text1.text=objhtml.htmltext
end if
timer1.enabled=false
end if
end sub
我测试过了,的确webbrowser快,可是要立刻得到源代码好像就慢了些
为什么半天都得不到内容呢?text1.text=objhtml.htmltext
感谢
将timer1时间调短一些
Alias "URLDownloadToFileA" _
(ByVal pCaller As Long, _
ByVal szURL As String, _
ByVal szFileName As String, _
ByVal dwReserved As Long, _
ByVal lpfnCB As Long) As Long
Private Sub Command1_Click()
URLDownloadToFile 0, "http://office.9zp.com/index.asp", "c:\test.txt", 0, 0
End Sub
其实还有更快的------URLOpenStream(类似URLDownloadToFile)
URLOpenStream如何使用-----看API资料或微软MSDN网站
Alias "URLOpenStreamA" _
(ByVal pCaller As Long, _
ByVal szURL As String, _
ByVal content As String, _
ByVal dwReserved As Long, _
ByVal lpfnCB As Long) As Long
Private Sub Command1_Click()
Dim content As Variant
URLOpenStream 0, "http://www.sohu.com", content, 0, 0
MsgBox content
End Sub无法实现!为什么不能直接给content值呢??
IStream * pStream;
URLOpenStream (NULL, L"http://www.msn.com/", &pStream,
0, 0);char buffer[0x100];DWORD dwGot;
HRESULT hr = NOERROR;do {
hr = pStream->Read (buffer, sizeof(buffer),&dwGot); //.. do something with contents of buffer ...
} while (SUCCEEDED(hr));
.
可是明明URLOpenStream没有定义什么数据输出接口呀
msdn 上是这么定义的HRESULT URLOpenStream(
LPUNKNOWN pCaller,
LPCSTR szURL,
DWORD dwReserved,
LPBINDSTATUSCALLBACK lpfnCB
)
哪位高手能解释解释如何得到内容,难道也要做个地址指针来循环吗?