Question: I'm trying to disable the right mouse button (the context menu) in the window of Chromium Embedded (DCEF3) but I'm not getting, I did not find any settings to do this natively.

I can for example disable the "View Source", I am using the code below, but I really want is to disable the context menu, or do not want it to appear.

Note: I'm using this in DLL "Chromium.dll" a libray to be used with the "Inno Setup", equal to 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;

```

Answer: 
To disable the context menu in DCEF 3 you'll need to handle the [`OnBeforeContextMenu`](http://magpcss.org/ceforum/apidocs3/projects/%28default%29/CefContextMenuHandler.html#OnBeforeContextMenu) event and clear its `model` parameter. That's what the reference states (emphasized by me):

> 
> **OnBeforeContextMenu**
> 
> 
> Called before a context menu is displayed. |params| provides
>  information about the context menu state. |model| initially contains
>  the default context menu. **The |model| can be cleared to show no
>  context menu** or modified to show a custom menu. Do not keep
>  references to |params| or |model| outside of this callback.
> 
> 
> 

So, to completely disable the context menu you will write something like this:

```
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;

```
Note: in the C++ version:

```
void ClientHandler::OnBeforeContextMenu(
    CefRefPtr<CefBrowser> browser,
    CefRefPtr<CefFrame> frame,
    CefRefPtr<CefContextMenuParams> params,
    CefRefPtr<CefMenuModel> model) {
  CEF_REQUIRE_UI_THREAD();

    //Clear disables the context menu
    model->Clear();
  }
}

```