delphi的webBrowser操作HTML研究
测试例子:
外网电脑D:\TEST\delphiTest\webbrowsetest
参考文档:
delphi 操作WebBrowser 元素值
http://hi.baidu.com/kinglike/item/c4608a8e55313f874514cf5c
delphi中WEBBrowser网页JS函数调用delphi函数
http://blog.csdn.net/iseekcode/article/details/4740269
webbrowser精华内容
http://blog.csdn.net/iseekcode/article/details/4740367
delphi 向webbrowser打开的网页中插入js命令
http://blog.csdn.net/iseekcode/article/details/4740286
1.获取WEB控件值
function TForm1.fgetValue(editName: string): string;
var
i:integer;
Doc:IHTMLDocument2;
input:OleVariant;
userinputelement,pwdinputelement,ValidateElement:ihtmlinputelement;
ValidateImage: IHTMLImgElement;
imagecount:integer;
form:ihtmlformelement;
myitem:Olevariant;
begin
Doc:=WebBrowser1.document as ihtmldocument2;
if doc=nil then exit;
// 第一种方式
userinputelement:=(doc.all.item(editName,0) as ihtmlinputelement);
Result := userinputelement.value;
end;
2.设置WEB控件值
procedure TForm1.setValueClick(Sender: TObject);
var
i:integer;
Doc:IHTMLDocument2;
input:OleVariant;
userinputelement,pwdinputelement,ValidateElement:ihtmlinputelement;
ValidateImage: IHTMLImgElement;
imagecount:integer;
form:ihtmlformelement;
myitem:Olevariant;
begin
Doc:=WebBrowser1.document as ihtmldocument2;
if doc=nil then exit;
// 第一种方式
userinputelement:=(doc.all.item('userName',0) as ihtmlinputelement);
userinputelement.value:='ADMIN';
userinputelement:=(doc.all.item('password',0) as ihtmlinputelement);
userinputelement.value:='1';
end;
3.WEB调用DELPHI
procedure TForm1.WebBrowser1BeforeNavigate2(ASender: TObject;
const pDisp: IDispatch; const URL, Flags, TargetFrameName, PostData,
Headers: OleVariant; var Cancel: WordBool);
begin
// showmessage(url);
if pos('qwbbLocatePage.action', url) > 0 then
begin
ShowMessage(fgetValue('userName'));
Cancel:= true;
end;
end;
delphi的webBrowser操作HTML研究的更多相关文章
- delphi中webbrowser的用法
WebBrowser1.GoHome; //到浏览器默认主页 WebBrowser1.Refresh; //刷新 WebBrowser1.GoBack; //后退 WebBrowser1.GoForw ...
- Delphi中WebBrowser控件打开部分网站报"Invalid floating point operation”解决
Delphi中WebBrowser控件打开部分网站报"Invalid floating point operation”解决 EmbeddedWBWebBrowserDelphi 最近用E ...
- C#的WebBrowser操作frame如此简单
刚学c#不久,也不太懂什么IHTMLDocument.IHTMLDocument2.IWebBrowser2等等.自己琢磨了好久,终于知道了怎么用WebBrowser操作frame和iframe. 1 ...
- HttpWebRequest post 提交 C#的WebBrowser操作frame如此简单 WebClient 提交
//http://www.cnblogs.com/cgli/archive/2011/04/09/2010497.html System.Net.ServicePointManager.Expect1 ...
- Delphi中的操作二进制文件的两个重要函数
Delphi中的操作二进制文件的两个重要函数 对于通过Byte数组进行文件操作的,在FTP中经常会使用到,我也是在Delphi调用Web Service进行文件的上传和下载时找到这两个函数的,挺好用的 ...
- C#的WebBrowser操作frame
刚学c#不久,也不太懂什么IHTMLDocument.IHTMLDocument2.IWebBrowser2等等.自己琢磨了好久,终于知道了怎么用WebBrowser操作frame和iframe. 1 ...
- delphi 文件的操作:重命名、复制、移动、删除
Delphi 文件的操作:重命名.复制.移动.删除第一种方法: RenameFile('Oldname', 'Newname'); CopyFile(PChar('Oldname'), PChar(' ...
- delphi 注册表操作(读取、添加、删除、修改)完全手册
DELPHI VS PASCAL(87) 32位Delphi程序中可利用TRegistry对象来存取注册表文件中的信息. 一.创建和释放TRegistry对象 1.创建TRegistry对象.为了操 ...
- delphi中WEBBrowser网页html相互调用(一)
1.基本操作1.1.激活 var doc,url:Olevariant ; begin url:='about:blank' ;//或者一个有实际意义的url WebBrowser1.Navigate ...
随机推荐
- [MetroUI-1]无边框模式
Wpf中取消边框,使用 WindowStyle="None" AllowsTransparency="True"
- 使用Apache Bench进行压力测试
Apache Bench是Apache中自带的压力测试工具 在linux中我们安装好apache后可以通过ab指令使用它 格式:ab [参数] [http://]ip地址/path/ 常用参数说明: ...
- jq制作博客已存在多少天
function current(){ var d=new Date(),str=''; var date=((d.getMonth()+1)*30+(d.getFullYear())*365+d.g ...
- php以post方式向接口发送数据
工作需要,我负责收集服务器数据,然后定时向中心服务器发送.我看到了接口信息,需要设置heads头信息,需要发送数据,且是post方式. 这里就用到了curl //发送post请求 function r ...
- PowerDesigner 15.2入门学习 一
好久没有搞 PowerDesigner 然后记录一下 1.下载地址 http://download.sybase.com/eval/PowerDesigner/PowerDesigner152_Eva ...
- Java项目中的classpath
一. 首先 classpath 是指 :项目路径\target\classes目录: 二.解释classes含义: 1.存放各种资源配置文件 2.存放模板文件 3.存放class文件, 对应的是项目开 ...
- A trip through the Graphics Pipeline 2011_12 Tessellation
Welcome back! This time, we’ll look into what is perhaps the “poster boy” feature introduced with th ...
- Cookie 知识点再整理
1. Cookie 是存储在客户端 内存 或者 硬盘(例如火狐把 Cookie 存储在 C:\Documents and Settings\用户名\Application Data\Mozilla\ ...
- EditText中输入手机号码时,自动添加空格
输入手机号码时,自动添加空格,更容易辨别 public class PhoneWatcher implements TextWatcher { private EditText _text; publ ...
- INSTRUCTION CYCLE
COMPUTER ORGANIZATION AND ARCHITECTURE DESIGNING FOR PERFORMANCE NINTH EDITION • Fetch: Read the nex ...