Skip to content

Set a window at the not minimized include Show Desktop Button, [Window] + D

License

Notifications You must be signed in to change notification settings

leonelsr/electron-disable-minimize

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

image npm version

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

Installation

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

Usage

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.

Forked from

Authors

License

This project is licensed under the MIT License - see the LICENSE file for details

About

Set a window at the not minimized include Show Desktop Button, [Window] + D

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C++ 50.8%
  • JavaScript 33.1%
  • HTML 10.7%
  • Python 5.4%