求助吹版:下列程序为什么不能下载各章节小说内容
下列程序为什么不能下载各章节小说内容,仅能爬取各章节网址。请吹版示教,万事感谢!!!具体代码如下(待修改)
SET DEFAULT TO (ADDBS(JUSTPATH(SYS(16))))
DECLARE long PostMessageA IN user32 long,long,long,long
IF !FILE("仙道九绝.dbf")
CREATE TABLE 仙道九绝 (title C(100), addr C(254), txt M)
USE
ENDIF
USE 仙道九绝 ALIAS tu
of = CREATEOBJECT("form1")
of.show(1)
CLOSE TABLES ALL
CLEAR ALL
RETURN
DEFINE CLASS form1 as Form
width = 800
height = 600
AutoCenter = .T.
AllowOutput = .f.
ADD OBJECT but as commandbutton WITH left=10,top=10,width=100,height=22,caption="开始"
ADD OBJECT grd as grid WITH left=10,top=40,width=250,height=550,RecordSource="tu",AllowCellSelection=.f.
ADD OBJECT edt as editbox WITH left=280,top=40,width=510,height=550
ADD OBJECT web as Olecontrol with OleClass="Shell.Explorer.2",left=-100
PROCEDURE Destroy
UNBINDEVENTS(this.hWnd)
ENDPROC
PROCEDURE Init
this.web.Silent = .t.
BINDEVENT(this.hWnd, 0x401, this, "myMessage")
ENDPROC
PROCEDURE but.click
ZAP IN "tu"
thisform.edt.value = " "
thisform.web.navigate("http://www.)
ENDPROC
PROCEDURE grd.click
thisform.edt.value = tu.txt
thisform.edt.SelStart = 0
ENDPROC
PROCEDURE web.documentComplete(pdisp, url)
IF (SYS(3095, pdisp) == SYS(3095, this))
PostMessageA(thisform.hWnd, 0x401, 0, 0)
ENDIF
ENDPROC
FUNCTION myMessage(hWnd, uMsg, wParam, lParam)
dom = this.web.document
IF VARTYPE(dom) != "O"
this.Enabled = .t.
RETURN
ENDIF
IF EMPTY(tu.addr)
* #if 1 && 0 or 1
* ie版本高试用
* lis = dom.getElementsByClassName("line3")
* FOR EACH li IN lis
* INSERT INTO tu VALUES (li.firstChild.innertext, li.firstChild.href, "")
* ENDFOR
* #else
* ie版本低试用
lis = dom.getElementsByTagName("li")
FOR EACH li IN lis
IF li.classname == "line3"
INSERT INTO tu VALUES (;
li.getElementsByTagName("a").item[0].innertext,;
li.getElementsByTagName("a").item[0].href, "";
)
ENDIF
ENDFOR
* #endif
GO TOP IN "tu"
this.grd.setfocus
this.web.navigate(ALLTRIM(tu.addr))
RETURN
ENDIF
REPLACE tu.txt WITH ALLTRIM(tu.title)+ 0h0D0A0D0A + dom.getElementById("ad").innertext
? ALLTRIM(tu.title)
SKIP IN "tu"
IF !EOF("tu")
this.grd.setfocus
this.web.navigate(ALLTRIM(tu.addr))
RETURN
ENDIF
GO TOP IN "tu"
this.grd.setfocus
this.Enabled = .t.
ENDFUNC
ENDDEFINE






