可能上个问题说的不太清楚或是分值太低,致使无人问津,现在将代码简化,再次发表。
问题是:ShowMessage 为何总是0。下面是我的代码:procedure TForm1.FormCreate(Sender: TObject);
var
IDoc : IHTMLDocument2;
strHTML : String;
v : Variant;
begin IDoc := CreateComObject(Class_HTMLDOcument) as IHTMLDocument2;
try
IDoc.designMode := 'on';
while IDoc.readyState <> 'complete' do
Application.ProcessMessages;
v:= VarArrayCreate([0,0],VarVariant); strHTML := IdHttp.Get('http://www.sina.com.cn/');
v[0]:= strHTML;
IDoc.write(PSafeArray(System.TVarData(v).VArray)) ;
IDoc.designMode:='off';
while IDoc.readyState <> 'complete' do
Application.ProcessMessages; ShowMessage(IntToStr(HtmlDoc.Body.getAttribute('offsetHeight', 0)));
finally
IDoc := nil;
end;
end;
问题是:ShowMessage 为何总是0。下面是我的代码:procedure TForm1.FormCreate(Sender: TObject);
var
IDoc : IHTMLDocument2;
strHTML : String;
v : Variant;
begin IDoc := CreateComObject(Class_HTMLDOcument) as IHTMLDocument2;
try
IDoc.designMode := 'on';
while IDoc.readyState <> 'complete' do
Application.ProcessMessages;
v:= VarArrayCreate([0,0],VarVariant); strHTML := IdHttp.Get('http://www.sina.com.cn/');
v[0]:= strHTML;
IDoc.write(PSafeArray(System.TVarData(v).VArray)) ;
IDoc.designMode:='off';
while IDoc.readyState <> 'complete' do
Application.ProcessMessages; ShowMessage(IntToStr(HtmlDoc.Body.getAttribute('offsetHeight', 0)));
finally
IDoc := nil;
end;
end;
解决方案 »
- 删除模块的疑问?
- 大家請進!!(我是空谷幽蘭,開發新程序,大家推荐控件吧)
- 怎样实现"每月一日零点,统计上个月的数据生成文本文件,保存到指定的目录里,同时将文本文件发送个指定的EMail中"?
- 出错了,但不知错在哪?很短的一句代码.
- 关于delphi的消息处理机制,有一点不太明白
- 心痛只能放在心里,只能默默的接受。给你讲个我的真实的爱情故事!
- 获取句柄后的问题
- 如何实现全屏
- 求《delphi构建进销存系统-POS系统开发实例》的源码
- 如何在InstallShield Express 3.0以上版将制作的安装程序能让用户输入的序列号写进WINDOWS注册表中?
- ■(回答立刻给分)求救,关于颜色的设定??
- 为什么我的FastReport3.14不能增加多个自定义函数??
btw: HtmlDoc.Body.getAttribute('offsetHeight', 0))是干啥用的?
如果body没有指定这个属性,那么默认值为0。