vfp9.0通过WebBrowser控件获取QQ新闻标题及链接
来源:互联网 发布:java定义全局变量 编辑:程序博客网 时间:2024/06/05 04:09
*!* by:十豆三
*!* vfp版本:vfp9.0
*!* 控件名称: Microsoft Web Browser(Microsoft Internet Controls)
*!* 控件版本:1.1
*!* ProgID:Shell.Explorer.2
*!* 文件位置: C:\WINDOWS\system32\ieframe.dll
*!* 文件版本:8.00.6001.19098 (IE8.0)
Public oform1
oform1=Newobject("form1")
oform1.Show
Return
Define Class form1 As Form
Top = 11
Left = 26
Height = 600
Width = 800
DoCreate = .T.
Caption = "Form1"
Name = "Form1"
Add Object olecontrol1 As OleControl With ;
Top = 0, ;
Left = 0, ;
Height = 468, ;
Width = 800, ;
Name = "Olecontrol1", ;
OleClass = "Shell.Explorer.2", ;
OleLCID = 1033
Add Object command1 As CommandButton With ;
Top = 521, ;
Left = 677, ;
Height = 25, ;
Width = 121, ;
Caption = "取得新闻标题和URL", ;
Name = "Command1"
Add Object grid1 As Grid With ;
DeleteMark = .F., ;
Height = 129, ;
Left = 2, ;
ReadOnly = .T., ;
Top = 470, ;
Visible = .F., ;
Width = 673, ;
Name = "Grid1"
Procedure Load
_vfp.AutoYield=.F.
Endproc
Procedure Unload
_vfp.AutoYield=.T.
Endproc
Procedure olecontrol1.Init
This.Navigate("http://roll.news.qq.com/")
Endproc
Procedure command1.Click
lcMyCaption=This.Caption
This.Caption='正在获取......'
This.Enabled=.F.
Create Cursor T1 (类别 C(6),新闻标题 C(254),新闻链接 C(254),时间 C(11))
Thisform.Olecontrol1.Document.getElementById("auto_refresh").parentNode.className='check checked'
Thisform.Olecontrol1.Document.parentWindow.Execscript('AutoRefresh()') && 取消自动刷新
lnTotalPages=Val(Thisform.Olecontrol1.Document.getElementById("totalPage").Value) && 取得部页数
If Messagebox('共有'+Transform(lnTotalPages)+'页新闻,点<是>取得所有页的新闻,点击<否>只取当第1页的新闻。',4+32+256,'信息提示')=7
lnTotalPages=1
Endif
For m.lnJ=1 To lnTotalPages && 循环所有页,每页50条新闻,如果只需TOP N条,修改此处。
If m.lnJ>1
Thisform.Olecontrol1.Document.parentWindow.Execscript('nextPage()') && 下一页
Endif
Do While .T.
If Thisform.Olecontrol1.Document.getElementById("artContainer").innerhtml<>'<DIV class=loading>正在查询请稍候……</DIV>'
Exit
Endif
Inkey(0.2,"H") &&防止程序失去响应
Enddo
lcListStr=Thisform.Olecontrol1.Document.getElementById("artContainer").innerhtml && 取得当前页新闻内容
lnLIs=Occurs('<LI>',lcListStr)
For m.lnI=1 To lnLIs
Insert Into T1 Values (Strextract(lcListStr,'t-tit>','</SPAN><A',m.lnI),Strextract(lcListStr,'"undefined">','</A>',m.lnI),Strextract(lcListStr,'href="','" target',m.lnI),Strextract(lcListStr,'t-time>','</SPAN><SPAN',m.lnI))
Endfor
Endfor
Locate
Thisform.Grid1.RecordSource='T1'
Thisform.Grid1.Visible=.T.
Thisform.Grid1.AutoFit()
Thisform.Grid1.Refresh
This.Caption=lcMyCaption
This.Enabled=.T.
Messagebox('取得新闻信息完成!'+Chr(10)+Chr(10)+'共取得'+Transform(Reccount('T1'))+'条新闻',64,'信息提示')
Endproc
Procedure grid1.Scrolled
Lparameters nDirection
This.AutoFit()
Endproc
Enddefine
- vfp9.0通过WebBrowser控件获取QQ新闻标题及链接
- vfp9.0通过WebBrowser控件获取QQ新闻标题及链接
- 【C#】通过webbrowser控件获取验证码
- 通过webbrowser控件获取验证码
- 【C#】通过webbrowser控件自动注册QQ号讲解
- python获取新闻标题及发布时间
- VB.NET 通过窗口句柄,获取webbrowser控件HTML内容
- 关于python网络爬虫——摘取新闻标题及链接
- VFP9.0中通过FFC类库使用GDI+
- 通过 WebBrowser 获取网页截图
- 通过 WebBrowser 获取网页截图
- WebBrowser 控件获取POST数据
- WebBrowser 控件获取POST数据
- c#中获取webbrowser控件加载页面中的链接的地址
- Axure RP 新闻标题链接制作
- Python抓取新闻标题和链接
- C#通过webbrowser控件与javascript交互
- C#通过webbrowser控件与javascript交互
- 数据库范式
- ConcurrentLinkedQueue
- 在HibernateTemplate里执行Sql语句
- android 关于view 中 getTag()和setTag()方法使用示例
- MFC修改button的颜色、背景、边框
- vfp9.0通过WebBrowser控件获取QQ新闻标题及链接
- Application Components(应用的构成)
- SQLite3 C/C++ 开发接口简介(API函数) 二(zt)
- 堆和栈的区别(转过无数次的文章)
- Cookie对应多个值的用法、访问次数
- 实际工程中碰到的一个问题
- 一个Java程序员应该掌握的10项技能
- javascript 中 方法call()的理解
- 戏说语义网——简介