<td class="tdn">Postings:</td>
<td class="tdn">870[img]pictures/posts.gif[/img]Function PosEx(Const SubStr, S: AnsiString; Offset: LongInt = 1): LongInt;
ASM
PUSH ESI
PUSH EDI
PUSH EBX
TEST &SubStr, &SubStr
JE @Exit
TEST &S, &S
JE @Exit0
TEST &Offset, &Offset
JG @POff
MOV &Offset, 1
@POff:
MOV ESI, &SubStr
MOV EDI, &S
PUSH EDI
MOV EAX, &Offset
DEC EAX
MOV ECX, [EDI - 4]
MOV EDX, [ESI - 4]
DEC EDX
JS @Fail
SUB ECX, EAX
ADD EDI, EAX
MOV AL, [ESI]
INC ESI
SUB ECX, EDX
JLE @Fail
@Loop:
REPNE SCASB
JNE @Fail
MOV EBX, ECX
PUSH ESI
PUSH EDI
MOV ECX, EDX
REPE CMPSB
POP EDI
POP ESI
JE @Found
MOV ECX, EBX
JMP @Loop
@Fail:
POP EDX
@Exit0:
XOR EAX, EAX
JMP @Exit
@Found:
POP EDX
MOV EAX, EDI
SUB EAX, EDX
@Exit:
POP EBX
POP EDI
POP ESI
End;
procedure TForm1.Button1Click(Sender: TObject);
var
source: String;
pos1, pos2, pos3, pos4 : Integer;
begin
source := Webbrowser1.OleObject.Document.Body.innerHTML;
pos1 := Pos('<TD CLASS=TDN>', uppercase(source));
pos1 := pos1 + 14;
pos2 := Posex('</TD>', uppercase(source), Pos1+1);
pos3 := Posex('<TD CLASS=TDN>', uppercase(source), Pos1+2);
pos4 := Pos('<IMG ALT=POSTS', uppercase(source));
Caption := Copy(source, pos1, pos2 - pos1)+ Copy(source, pos3, pos4 - pos3);
memo1.Lines.Text:= uppercase(source);
end;