5,927
社区成员




for I := 0 to ListBox1.Items.Count-1 do
begin
Str := trim(ListBox1.Items.Strings[I]);
ListBox1.ItemIndex := I;
if (Length(Str) < 10) or (pos('http://',Str)< 0) then Continue;
WebBrowser4.Navigate(Str) ;
while (Form1.WebBrowser4.ReadyState <> READYSTATE_COMPLETE) do
begin
Application.ProcessMessages;
end;
//sleep(0);
for K := 0 to WebBrowser4.OleObject.Document.all.tags('span').Length - 1 do
begin
str1 := WebBrowser4.oleobject.document.all.tags('span').item(K).innertext;
if ansicontainsstr(str1,'write a comment') then begin
WebBrowser4.oleobject.document.all.tags('span').item(K).click;
break;
end;
end;
//GetElem('span','write a comment');
///////////////////////////////////////////////////////////////////////
if assigned(WebBrowser4) then
begin
doc := WebBrowser4.Document as ihtmldocument2;
ContentArea := doc.all.item('comment',0) as ihtmltextareaelement;
if ContentArea = nil then continue;
ContentArea.value := 'have a Test!';
for K := 0 to WebBrowser4.OleObject.Document.all.tags('span').Length - 1 do
begin
str1 := WebBrowser4.oleobject.document.all.tags('span').item(K).innertext;
if ansicontainsstr(str1,'submit comment') then begin
WebBrowser4.oleobject.document.all.tags('span').item(K).click;
break;
end;
end;
// GetElem('span','submit comment');
end;
end;
procedure TSendThread.Execute;
var
doc:ihtmldocument2;
ContentArea:ihtmltextareaelement;
I ,K: Integer;
Str,Str1 : string;
begin
for I := FStart to FEnd do
begin
Str := trim(Form1.ListBox1.Items.Strings[I]);
Form1.ListBox1.ItemIndex := I;
if (Length(Str) < 10) or (pos('http://',Str)< 0) then Continue;
Form1.WebBrowser4.Navigate(Str) ;
while (Form1.WebBrowser4.ReadyState <> READYSTATE_COMPLETE) do
begin
Application.ProcessMessages;
if Terminated then Exit;
end;
//sleep(0);
if Terminated then Exit;
for K := 0 to Form1.WebBrowser4.OleObject.Document.all.tags('span').Length - 1 do
begin
str1 := Form1.WebBrowser4.oleobject.document.all.tags('span').item(K).innertext;
if ansicontainsstr(str1,'write a comment') then begin
Form1.WebBrowser4.oleobject.document.all.tags('span').item(K).click;
break;
end;
end;
//GetElem('span','write a comment');
///////////////////////////////////////////////////////////////////////
if assigned(Form1.WebBrowser4) then
begin
doc := Form1.WebBrowser4.Document as ihtmldocument2;
ContentArea := doc.all.item('comment',0) as ihtmltextareaelement;
if ContentArea = nil then continue;
ContentArea.value := 'have a Test!';
for K := 0 to Form1.WebBrowser4.OleObject.Document.all.tags('span').Length - 1 do
begin
str1 := Form1.WebBrowser4.oleobject.document.all.tags('span').item(K).innertext;
if ansicontainsstr(str1,'submit comment') then begin
Form1.WebBrowser4.oleobject.document.all.tags('span').item(K).click;
break;
end;
end;
// GetElem('span','submit comment');
end;
if Terminated then Exit;
end;
end;
for ....................... do
begin
Form1.WebBrowser4.Navigate(Str) ;
while (Form1.WebBrowser4.ReadyState <> READYSTATE_COMPLETE) do
begin
Application.ProcessMessages;
if Terminated then Exit;
end;
end;
1.access violation at address.. mshtml.Dll Read .......
CoInitialize(nil);
//.........
CoUninitialize;