electron 无边框窗体如何取消右键上下文菜单;
Menu.setApplicationMenu(null) 设置无效,
请教下还有其他方法吗
/**
@param win{BrowserWindow}
**/
function preventDragbarContext(win) {
var WM_INITMENU = 0x116;//278
win.hookWindowMessage(WM_INITMENU, function (e) {
console.log('hook', e);
win.setEnabled(false);
setTimeout(() => {
win.setEnabled(true);
}, 100);
return true;
})
}
我也是百度出来的,大概意思是标题栏或者设置css的 -webkit-app-region: drag;的元素,当接收到右键的时候进行拦截,先设置窗口禁用,然后定时恢复,我也想知道钉钉怎么实现的,他的拖拽组件不仅可以禁用右键,还可以点击