This module allow you to set the window attached to the HWND handle to disable minimized.
Electron indeed have a minimizable: false
but it minimized at Windows + D (Show Desktop) Event.
This module uses the following c++ code. (Thanks to tordex)
HWND nWinHandle = FindWindowEx(NULL, NULL, "Progman", NULL);
nWinHandle = FindWindowEx(nWinHandle, NULL, "SHELLDLL_DefView", NULL);
SetWindowLongPtr(hwnd, -8, (LONG_PTR)nWinHandle);
npm i -S electron-disable-minimize # install the module
"./node_modules/.bin/electron-rebuild" -f -w electron-disable-minimize # rebuild the module to match your electron version
Look at the index.html, index.js and package.json file to integrate it into your Electron application
Basically it consists of 2 steps
- Include the module in your .js file:
import { DisableMinimize } from 'electron-disable-minimize';
- or -
const { DisableMinimize } = require('electron-disable-minimize');
- Create your Electron BrowserWindow
let mainWindow = new BrowserWindow({
height: 800,
width: 800,
useContentSize: true,
transparent: !isDev,
frame: isDev,
focusable: isDev,
show: false
});
// load it
mainWindow.loadURL(__dirname + "/index.html");
//show it
mainWindow.show();
// get the native HWND handle
let handle = mainWindow.getNativeWindowHandle();
// Disable Minimize Perfectly!
DisableMinimize(handle); // boolean
If false returned, disable failed. It works specific Windows status. I don't know why disable failed. Windows restart recommend.
- tbvjaos510 - tbvjaos510
This project is licensed under the MIT License - see the LICENSE file for details