O'Reilly logo

Microsoft® Visual Basic® .NET Programmer's Cookbook by Matthew MacDonald

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Handle Operating System Events

Problem

You want your code to react to a Windows system event, such as a modification of system or desktop settings.

Solution

Add an event handler to one of the shared events provided by the Microsoft.Win32.SystemEvents class.

Discussion

The SystemEvents class provides references to several global system events, including:

  • DisplaySettingsChanged. occurs when the display settings (for example, screen resolution) are changed.

  • InstalledFontsChanged. occurs when the user adds fonts to or removes fonts from the system.

  • LowMemory. occurs if the system is running out of available RAM.

  • PaletteChanged. occurs when the user switches to an application that uses a different 256-color palette. This event occurs only in 256- color mode. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required