Custom CefContextMenu Outside of Window (i.e SystemTray)

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

Custom CefContextMenu Outside of Window (i.e SystemTray)

Postby OPstriker » Sat Nov 26, 2022 4:37 pm

Hello!,

Currently I am developing an Application that requires a System Tray icon (Windows). I realized that Cef has a builtin ContextMenu and I tried to implement it by calling RunContextMenu() when the user right clicks on the System tray Icon. But Whenever I call a callback the application keeps crashing with

[1126/160816.273:FATAL:cef_scoped_refptr.h(276)] Check failed: ptr_.


I tried to also implement OnBeforeContextMenu() but i still dont get a menu displayed... Implementation inside root_window_win.cc

Code: Select all
 
...
void RootWindowWin::OnBeforeContextMenu(CefRefPtr<CefMenuModel> model) {
  model->AddItem(0, "Hellow World");
}

bool RootWindowWin::RunContextMenu(CefRefPtr<CefRunContextMenuCallback> callback) {
  CEF_REQUIRE_UI_THREAD();
  callback->Cancel();

  return true;
}
...


I am also not really sure whether this is possible or not.
OPstriker
Newbie
 
Posts: 2
Joined: Fri Sep 30, 2022 7:31 pm

Return to Support Forum

Who is online

Users browsing this forum: Google [Bot] and 42 guests