inno-setup – 禁用Chromium Embedded 3(DCEF3)中的上下文菜单
我正在尝试在Chromium Embedded(DCEF3)的窗口中禁用鼠标右键(上下文菜单),但我没有得到,我没有找到任何设置来本机执行此操作.
我可以禁用“查看源代码”,我正在使用下面的代码,但我真的想要禁用上下文菜单,或者不希望它出现. 注意:我在DLL“Chromium.dll”中使用这个libray与“Inno Setup”一起使用,等同于Inno Web Brower. procedure TInnoChromium.OnContextMenuCommand(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; const params: ICefContextMenuParams; commandId: Integer; eventFlags: TCefEventFlags; out Result: Boolean); begin if (commandId = 132) then Result := True; // MENU_ID_VIEW_SOURCE end; 解决方法
要禁用DCEF 3中的上下文菜单,您需要处理
OnBeforeContextMenu 事件并清除其模型参数.这就是参考文献所指出的内容(我强调):
因此,要完全禁用上下文菜单,您将编写如下内容: uses cefvcl,ceflib; type TInnoChromium = class ... private FChromium: TChromium; procedure BeforeContextMenu(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; public constructor Create; end; implementation constructor TInnoChromium.Create; begin FChromium := TChromium.Create(nil); ... FChromium.OnBeforeContextMenu := BeforeContextMenu; end; procedure TInnoChromium.BeforeContextMenu(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; const params: ICefContextMenuParams; const model: ICefMenuModel); begin // to disable the context menu clear the model parameter model.Clear; end; (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |