请问一下,用vb提取网页中的链接,应该知道些什么知识,本人是新手。

本人知道用winsock读取网页... 本人知道用winsock
读取网页
展开
 我来答
个人整理资料
2011-01-29 · TA获得超过397个赞
知道小有建树答主
回答量:493
采纳率:0%
帮助的人:431万
展开全部
不用知道太多,最好会正则表达式,那样会简单点。要了解HTML语言,最起码知道<a>...</a>是链接标志,至于VB怎么读取网页和处理字符串是必须知道的
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
百度网友e7886d4
2011-01-29 · TA获得超过1502个赞
知道小有建树答主
回答量:1195
采纳率:0%
帮助的人:293万
展开全部
v

楼上的.....

你是用了WebBrowser控件~....并不是针对IE来的 `

代码如下:

'窗体
Private Sub Command1_Click()
Text1.Text = GetWebSite(FindWindow("IEFrame", vbNullString))
End Sub

'模块
Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Declare Function SetCapture Lib "user32" (ByVal hwnd As Long) As Long
Declare Function ClientToScreen Lib "user32" (ByVal hwnd As Long, lpPoint As POINTAPI) As Long
Declare Function WindowFromPoint Lib "user32" (ByVal xPoint As Long, ByVal yPoint As Long) As Long
'Declare Function GetLastError Lib "kernel32" () As Long
Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As String) As Long
'Declare Function ReleaseCapture Lib "user32" () As Long
Declare Function GetClassName Lib "user32" Alias "GetClassNameA" (ByVal hwnd As Long, ByVal lpClassName As String, ByVal nMaxCount As Long) As Long

Const WM_GETTEXT = &HD
Type POINTAPI
x As Long
y As Long
End Type

'-
Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long

Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
Declare Function GetWindowTextLength Lib "user32" Alias "GetWindowTextLengthA" (ByVal hwnd As Long) As Long
Public Const WM_QUIT = &H12
Public Const WM_CLOSE = &H10
Dim A, B, C, D, E
Dim LrMem(1 To 5) As Long
Dim TP As Long
Public Function GetWebSite(IehWnd As Long) As String
Dim Ws As Long, Sa As Long
Ws = FindWindow("IEFrame", vbNullString)
Sa = GetIeEdit(Ws)
GetWebSite = WMGETTEXT(Sa)

End Function
Public Function GetIeEdit(IehWnd As Long) As Long
Dim Aa As Long

If IehWnd = 0 Then Exit Function
Aa = FindWindowEx(IehWnd, 0, "WorkerW", vbNullString)
If Aa = 0 Then Exit Function
Aa = FindWindowEx(Aa, 0, "ReBarWindow32", vbNullString)
If Aa = 0 Then Exit Function

Aa = FindWindowEx(Aa, 0, "ComboBoxEx32", vbNullString)
If Aa = 0 Then Exit Function

Aa = FindWindowEx(Aa, 0, "ComboBox", vbNullString)
If Aa = 0 Then Exit Function

Aa = FindWindowEx(Aa, 0, "Edit", vbNullString)

If Aa = 0 Then Exit Function

GetIeEdit = Aa

End Function
Public Function WMGETTEXT(EdithWnd As Long) As String
Dim EditContent As String
EditContent = Space(65536)
SendMessage EdithWnd, WM_GETTEXT, 65536, EditContent
WMGETTEXT = Trim(EditContent)
End Function
Public Function FindIEWindow() As Long
FindIEWindow = FindWindow("IEFrame", vbNullString)

End Function
本回答被网友采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式