« Xojo 2014r2.1 | Home | MBS Filemaker Plugin,… »

Tip of the day: Windows Notifications

In 2012 we added to our plugins a WinNotificationMBS class. This class was designed to send and receive broadcast messages on Windows between running apps. This way a helper app can send status updates easily to main app. Without the need to setup IPCSocket or other ways of communication.

Now Windows also sends a couple of messages to everyone about certain things. Like you can get a WM_DISPLAYCHANGE message whenever the display setup changed. Also the WM_DEVICECHANGE message informs about devices coming and going.

To use this, get a subclass of WinNotificationMBS and add the GotNotification event. Now listen for messages WM_DISPLAYCHANGE (&h7E) and WM_DEVICECHANGE (&h0219). The event will be called with those message codes so you can check state and update your app.

PS: On Mac you can also get similar events with NSWorkSpaceMBS and NSNotificationObserverMBS.
17 08 14 - 14:57