打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
delphi chrome cef3 控件学习笔记 (五)

 一、模拟移动鼠标

//  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

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
Delphi中Webbrowser自动登录路由器网页
Delphi 之 WebBrowser内 模拟按键输入
窗口切换
外挂原理1
鼠标、键盘模拟技术
Python驱动级按键
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服