UNPKG

gpii-windows

Version:

Components of the GPII personalization infrastructure for use on Microsoft's "Windows" ™

16 lines (11 loc) 977 B
# Window Messages This modules provides the ability to receive window messages that have been broad-casted to top-level windows (like [WM_DEVICECHANGE](https://msdn.microsoft.com/library/aa363480), for the USB user listener). A hidden window is created, whose only purpose is to receive messages. The `gpii.windows.messages` component raises the `onMessage` event whenever the message window receives a message. A [message loop](https://en.wikipedia.org/wiki/Message_loop_in_Microsoft_Windows) is required in order to process messages. When running inside Electron, one is already provided and messages are sent to this window for free. When running in plain node however, a loop must be implemented. Traditionally, [GetMessage](https://msdn.microsoft.com/library/ms644936) is used to wait for a message to be sent to the thread, but this blocks so isn't suitable for node. Instead, [PeekMessage](https://msdn.microsoft.com/library/ms644943) is slowly polled via a timer.