• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Delphi中ChromeChromium、Cef3学习笔记(五)

原作者: [db:作者] 来自: [db:来源] 收藏 邀请
 

一、模拟移动鼠标

//  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','ProxyIP','')     ini.Free;     commandLine.AppendSwitchWithValue(str_ip);     if Assigned(CefOnBeforeCommandLineProcessing) then       CefOnBeforeCommandLineProcessing(processType, commandLine);   end;


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
matlab中size函数总结发布时间:2022-07-18
下一篇:
Matlab当中size() length()等函数讲解发布时间:2022-07-18
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap