Delphi中Chrome Chromium、Cef3学习笔记(六)

一.CEF加载网页时空白

  chrm1.Load(‘你的网址’);

出现空白,跟踪进去:

    frm := FBrowser.MainFrame;  //此时为nil ,可改为:

    frm := FBrowser.GetMainFrame;  

其他地方同上;


后续待更新。。

二、CEF程序退出时报错

 {$R *.res}
 
procedure RegisterSchemes(const registrar: ICefSchemeRegistrar);
begin
  registrar.AddCustomScheme('local', True, True, False);
end;


begin
//  CefCache := getEnvironmentVariable('USERPROFILE')+'\GetTBData\cookies\';
  
  CefCache := 'cache';
  CefOnRegisterCustomSchemes := RegisterSchemes;
  CefSingleProcess := False;
  if not CefLoadLibDefault then
    Exit;


//  CefUserAgent := 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0;';
//  CefUserAgent := 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_0) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.56 Safari/535.11';
  Application.Initialize;
  Application.CreateForm(TuMain, uMain);
  Application.Run;
end.

三、Cef3加载flash网页方法:

修改ceflib.pas:

  procedure TInternalApp.OnBeforeCommandLineProcessing(const processType: ustring;
      const commandLine: ICefCommandLine);
  begin
    CommandLine.AppendSwitch('ppapi-out-of-process');
    CommandLine.AppendSwitchWithValue('ppapi-flash-version', '22.0.0.168');
    CommandLine.AppendSwitchWithValue('ppapi-flash-path', 'Plugins\\pepflashplayer.dll');


    if Assigned(CefOnBeforeCommandLineProcessing) then
      CefOnBeforeCommandLineProcessing(processType, commandLine);
  end;

网上下载 pepflashplayer.dll放入..\Plugins\\目录下面。

四、cef3启动加载flash网页时Dos窗口闪一下的问题

网上的解决方法,参考此文。

http://blog.csdn.net/zx2356/article/details/51514403

按照该文及提供的下载挂钩createProcessA,在xp上无效。

2.解决方法

有可能createprocessw也得挂钩。但懒得修改了。因此决定改为反编译flash插件,看看显示命令行窗口的逻辑。

反编译flash插件。发现显示cmd的逻辑是,读取环境变量comspec(cmd.exe的全路径),读取到就执行它,读取不到执行cmd.exe.

用winhex修改flash插件,搜索comspec为soms1ec,修改cmd.exe为cm1.exe.

重新测试,成功。


修改后插件下载链接

http://download.csdn.net/detail/qsy2000/9768385


转载请注明出处,原文地址:

http://blog.csdn.net/xtfnpgy/article/details/71703317


  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值