看看下面的代码(0分)

T

TanXin

Unregistered / Unconfirmed
GUEST, unregistred user!
var
x,i: integer;
str:WideString;
ISW: IShellWindows;
spDisp: IDispatch;
IWB: IWebbrowser2;
IDoc:IHTMLDocument2 ;
InputText:IHTMLInputTextElement;
IEle:IHTMLElement;
begin

ISW := CoShellWindows.Create;
for x := 0 to ISW.Count - 1 do
begin
Memo1.Lines.Add((ISW.Item(x) as IWebbrowser2).LocationUrl);
Memo1.Lines.Add('...............................................................');
spDisp := ISW.Item(x);
spDisp.QueryInterface( IWebbrowser2,IWB);
if IWB<> nil then
begin
IWB.Document.QueryInterface(IHTMLDocument2,iDoc);
if (iDoc <> nil) then
begin
if((iDoc.charset<>'utf-8')and(IDoc.charset<>'gb2312'))then
begin
IWb.Quit();
ShowMessage('µ±Ç°ÏµÍ³½ûÖ¹ä¯ÀÀÍâ¹úÍøÕ¾');
end;
end;
end;
end;
end;

我用这段代码来获取一个网站中的charset字段(网页的编码方式),但是却有的正确,有的不正确,请这是什么原因?
 
顶部