(转)delphi chrome cef3 控件学习笔记 (五)
2016-04-27 14:19
609 查看
一、模拟移动鼠标
// SetCursorPos(StrToInt(Edit1.Text),StrToInt(Edit2.Text)); //相对屏幕位置
SetCursorPos(Self.Left+chrm1.Left+strtoint(Edit1.Text),Self.Top+chrm1.Top+strtoint(Edit2.Text)); //相对Chrm位置
mouse_event(MOUSEEVENTF_LEFTDOWN,0,0,0,0);//模拟按下鼠标左键。
mouse_event(MOUSEEVENTF_LEFTUP,0,0,0,0);//模拟放开鼠标左键。
keybd_event(VK_SHIFT,MapVirtualKey(VK_SHIFT,0),0,0); //按下SHIFT键。
keybd_event(0x52,MapVirtualKey(0x52,0),0,0);//按下R键。
keybd_event(0x52,MapVirtualKey(0x52,0),KEYEVENTF_KEYUP,0);//放开R键。
keybd_event(VK_SHIFT,MapVirtualKey(VK_SHIFT,0),KEYEVENTF_KEYUP,0);//放开SHIFT键。
二、Chromiume控件指定坐标点击 SendMessage(GetWindow(GetWindow(form1.chrm1.Handle, GW_CHILD), GW_CHILD),WM_LBUTTONDOWN,MK_LBUTTON, MAKELONG(StrToIntDef(Edit1.Text,100),StrToIntDef(Edit2.Text,100)));
SendMessage(GetWindow(GetWindow(form1.chrm1.Handle, GW_CHILD), GW_CHILD),WM_LBUTTONUP,MK_LBUTTON, MAKELONG(StrToIntDef(Edit1.Text,100),StrToIntDef(Edit2.Text,100)));
MK_LBUTTON可以改为0,MAKELONG可以改为MAKELParam
三、JS控制滚动条的位置:
window.scrollTo(x,y);
竖向滚动条置顶(window.scrollTo(0,0);
竖向滚动条置底 window.scrollTo(0,document.body.scrollHeight)
四、设置代理ip
ceflib.pas单元:
uses iniFiles;
procedure TInternalApp.OnBeforeCommandLineProcessing(const processType: ustring;
const commandLine: ICefCommandLine);
var
ini : TIniFile;
str_ip : string;
begin
ini := TIniFile.Create(StringReplace(ParamStr(0),'.exe','.ini',[]));
str_ip := ini.ReadString('default','Proxy','');
ini.Free;
commandLine.AppendSwitchWithValue('proxy-server',str_ip);
if Assigned(CefOnBeforeCommandLineProcessing) then
CefOnBeforeCommandLineProcessing(processType, commandLine);
end;
[default]
Proxy=218.189.26.20:8080
Proxy1=218.207.212.79:80
Proxy2=120.203.159.18:8118
// SetCursorPos(StrToInt(Edit1.Text),StrToInt(Edit2.Text)); //相对屏幕位置
SetCursorPos(Self.Left+chrm1.Left+strtoint(Edit1.Text),Self.Top+chrm1.Top+strtoint(Edit2.Text)); //相对Chrm位置
mouse_event(MOUSEEVENTF_LEFTDOWN,0,0,0,0);//模拟按下鼠标左键。
mouse_event(MOUSEEVENTF_LEFTUP,0,0,0,0);//模拟放开鼠标左键。
keybd_event(VK_SHIFT,MapVirtualKey(VK_SHIFT,0),0,0); //按下SHIFT键。
keybd_event(0x52,MapVirtualKey(0x52,0),0,0);//按下R键。
keybd_event(0x52,MapVirtualKey(0x52,0),KEYEVENTF_KEYUP,0);//放开R键。
keybd_event(VK_SHIFT,MapVirtualKey(VK_SHIFT,0),KEYEVENTF_KEYUP,0);//放开SHIFT键。
二、Chromiume控件指定坐标点击 SendMessage(GetWindow(GetWindow(form1.chrm1.Handle, GW_CHILD), GW_CHILD),WM_LBUTTONDOWN,MK_LBUTTON, MAKELONG(StrToIntDef(Edit1.Text,100),StrToIntDef(Edit2.Text,100)));
SendMessage(GetWindow(GetWindow(form1.chrm1.Handle, GW_CHILD), GW_CHILD),WM_LBUTTONUP,MK_LBUTTON, MAKELONG(StrToIntDef(Edit1.Text,100),StrToIntDef(Edit2.Text,100)));
MK_LBUTTON可以改为0,MAKELONG可以改为MAKELParam
三、JS控制滚动条的位置:
window.scrollTo(x,y);
竖向滚动条置顶(window.scrollTo(0,0);
竖向滚动条置底 window.scrollTo(0,document.body.scrollHeight)
四、设置代理ip
ceflib.pas单元:
uses iniFiles;
procedure TInternalApp.OnBeforeCommandLineProcessing(const processType: ustring;
const commandLine: ICefCommandLine);
var
ini : TIniFile;
str_ip : string;
begin
ini := TIniFile.Create(StringReplace(ParamStr(0),'.exe','.ini',[]));
str_ip := ini.ReadString('default','Proxy','');
ini.Free;
commandLine.AppendSwitchWithValue('proxy-server',str_ip);
if Assigned(CefOnBeforeCommandLineProcessing) then
CefOnBeforeCommandLineProcessing(processType, commandLine);
end;
[default]
Proxy=218.189.26.20:8080
Proxy1=218.207.212.79:80
Proxy2=120.203.159.18:8118
相关文章推荐
- (转)delphi chrome cef3 控件学习笔记 (四)
- (转)delphi chrome cef3 控件学习笔记 (三)
- (转)delphi chrome cef3 控件学习笔记 (二)
- (转)delphi chrome cef3 控件学习笔记 (一)
- delphi 中判断windows系统是否是64位系统
- [转]HMAC functions in Delphi (HMAC_SHA256, HMAC_SHA1)
- 如何使DELPHI程序在Win7下自动请求以管理员身份运行
- delphi 动态结构数组例程
- delphi.memory.分配及释放---New/Dispose, GetMem/FreeMem及其它函数的区别与相同,内存分配函数
- Delphi指针详解
- Delphi通过MSHTML实现一个HTML解析类
- Delphi 10.1 Berlin 官方未列之修正
- 注册表写入二进制数据
- Delphi中动态调用DLL的方法
- delphi TeeChart保存3种图片文件
- 在Delphi中利用MSDASC来配置数据库链接
- Delphi 编写ActiveX控件(OCX控件)的知识和样例
- Delphi 编写DLL动态链接库文件的知识和样例
- Delphi 变体类型(Variant)的介绍(流与变体类型的相互转换、变体类型常用的函数)
- Delphi 编写ActiveForm窗体工程知识和样例(开发浏览器客户端应用程序)