给各位使用delphi借助CEF开发的朋友一个帮助

来源:互联网 发布:阿里云域名未备案 编辑:程序博客网 时间:2024/05/22 01:55

我一直不喜欢调用DELPHI自带的webbrowser作为网页浏览的潜入开发,因为对于这东西缺陷我实在不想做太多的评论,可是还是仍气吞声用了许久许久

所以还是推荐大家使用chromium来做开发


使用delphi的(有朋友已经写好)我就描述一下大家可能遇到的问题


Flash player无法使用 解决这个问题 拷贝你电脑里任何一个使用Chrome作为核心的浏览器的根目录下的 PepperFlash文件加到您的BIN目录内

在程序加载的时候植入下面代码


uses libcef;


////////启用Flashplayer

CefAddWebPluginPath(ExtractFilePath(Paramstr(0)) +'PepperFlash\pepflashplayer.dll');
CefRefreshWebPlugins();
if not CefLoadLibDefault then Exit;

//////////////////////////////////////


右键菜单


procedure TForm1.ApplicationEvents1Message(var Msg: tagMSG;
  var Handled: Boolean);
  var mPoint:Tpoint;
begin
if IsChild(Chromium1.Handle, Msg.Hwnd) and
    ((Msg.Message = WM_RBUTTONDOWN) or (Msg.Message = WM_RBUTTONUP)) then
  begin
    GetCursorPos(mPoint); //得到光标位置
    PopupMenu1.Popup(mPoint.X, mPoint.Y); //弹出popupmenu1的菜单
    Handled := True;
  end;
end;


方法在

Chromium1.Browser.Reload;

多的不说 其实就是Flashplayer这个问题 希望能够绑到你


0 0
原创粉丝点击