跨平台桌面程式架構 Cross Platform - Electron
- Slack: Building Hybrid Applications with Electron
- Learn to build your own desktop chat app with React and Electron
Node.js C++ Addons
- There are three options for implementing Addons:
Node.js Foreign Function Interface
Shell.js - Unix shell commands for Node.js
- Node Child Process
- ShellJS is a portable (Windows/Linux/OS X) implementation of Unix shell commands on top of the Node.js API. You can use it to eliminate your shell script’s dependency on Unix while still keeping its familiar and powerful commands. You can also install it globally so you can run it from outside Node projects - say goodbye to those gnarly Bash scripts!
Using Native Windows Features from Electron
- Calling Windows with Electron’s APIs
- Native Node Addons (without C++)
- Native Node Addons (with C++)
- SO: Why is it said that WinRT replaces the Windows API
Windows Native API
MS Docs: Choose your app platform
- Universal Windows Platform (UWMP)
- WPF (.NET)
- Windows Form (.NET)
- MS Docs:
- MS Docs:
- MS Doc: Platform Invoke (P/Invoke)
Getting the Active Process
- When developing software that monitors running processes, it can be useful to obtain details of the currently active application. The .NET framework does not provide methods to permit this so Platform Invocation Services (P/Invoke) must be used.
- When using Microsoft Windows, there can only be one active, or foreground, window. This is the window that can receive input from the user and whose owning thread has a slightly higher priority than other open windows. In some situations it can be useful to identify the active process that owns this window.
- The .NET framework provides a class, named “Process”, that allows you to examine the details of a running process. However, this class cannot be used to identify the program that is currently in use. In order to identify the foreground window and obtain a Process object linked to it, you must use Platform Invocation Services (P/Invoke) to call functions from the Windows API.
SO: How to track WinRT applications (in Win32 it was simple)?
- You see, in WinRT, your application is the top-most application. And when your app is not the top-most application then your threads are suspended and the kernel will not schedule any more operations for your app. End of story.
- This means what you are wanting to accomplish cannot be done in WinRT. You are thinking more like a resident app or a service with access to the desktop. Those apps have two advantages. 1) they are always running. And, 2) they have the API to do what you are wanting.
- WinRT intentionally puts apps in a sandbox so that the user’s experience, performance and battery life are protected. Your scenario and scores more like yours underscore the continuing need for desktop apps. (as long as there is a continuing need for those types of apps.
Windows Node API
Slack: Introducing Electron to the Windows Runtime
- 簡單介紹如何包裝Eletrcon App上Windows App Store
macOS Native API
Apple Dev: Window Layering and Types of Window
- Key Window. The key window responds to user input, whether from the keyboard, mouse, or alternative input devices, for an application and is the primary recipient of messages from menus and panels. Usually, a window is made key when the user clicks it. Each application can have only one key window at a given time.
- Main Window. The main window is the standard window where the user is currently working. The main window is not always the key window. There are times when a window other than the main window takes the focus of the input device, while the main window still remains the focus of the user’s attention and of user actions carried out in panels and menus.
- SO: In OS X, how can I detect when the currently active application changes?