如何将memo里的东西写到网页上的textarea里
我是新手入门,希望有热心的朋友能指点一下~
我是新手入门,希望有热心的朋友能指点一下~
解决方案 »
- 怎么在delphi程序中设置打印机的分辨率,使得打印程序在任何的打印机上打印出的效果都一样
- [Indy]用Indy做很卡 ?
- 又來挑戰大家!如何做Windows Media Player 一樣的讓窗體駐留在任務欄上?
- 怎样做到鱼与熊掌兼得?
- 在编写NT服务程序时,为什么不能用FINDWINDOWEX来查找窗口句柄?总是返回0
- 那位知道怎样将outlook中的地址(wab文件)导入自已的程序中呢
- 关于ActiveX的高级问题
- 问关于dbgrid.selectedrows
- 小小鸟(急电):用BDE的Table控件,dbGride显示数据其中“删除”按钮想转换成Ado的ADOTable 控制
- commandtext does not return a result set
- 高级话题!有谁了解RDP协议?
- 搞了这么多年Delphi, 居然被这个小问题搞死了!大家帮我看一看是不是Delphi的Bug呢
要是Application和Ie通讯,很难做到的
具体是这样:
窗体上有一个form,一个按扭
然后点一下按钮,把memo的东西复制到网页上的textarea里
就是这样,虽然我知道很简单,但我是新手,没接触过,所以希望有人能帮忙给讲解一下
分数一定送上
uses ShDocVw, MSHtml, ActiveX;procedure TForm1.Button1Click(Sender: TObject);
const
bbs = 'http://expert.csdn.net/Expert/topic/2101/2101191.xml?temp=.208172';
var
Win: IShellWindows;
Web: IWebBrowser2;
doc: IHtmlDocument2;
form: IHtmlFormElement;
textarea: IHTMLTextAreaElement;
itemname, itemindex: OleVariant;
I: Integer;
begin
Win := CoShellWindows.Create;
try
// 枚举所有ie窗口
for I := 0 to Win.Count - 1 do
begin
Web := Win.Item(I) as IWebBrowser2;
Log(Web.LocationURL);
if Web.LocationURL = bbs then
begin
Web.Document.QueryInterface(IHtmlDocument2, doc);
itemname := 'XmlRePly';
doc := (IDispatch(doc.frames.item(itemname)) as IHtmlWindow2).document as IHtmlDocument2;
itemindex := 0;
form := doc.forms.item(itemname, itemindex) as IHtmlFormElement;
itemname := 'ReplyContent';
textarea := form.item(itemname, itemindex) as IHtmlTextAreaElement;
textarea.value := Memo1.Text;
end;
end;
finally
Win := nil;
end;
end;procedure TForm1.Log(msg: String);
begin
Memo1.Lines.Add(msg);
end;