Chapter 14. Working in the Background

WHAT'S IN THIS CHAPTER?

  • Considering why your application should work in the background

  • Creating a trigger-start service

  • Providing power management

  • Adding restart and recovery to your application

  • Accessing the network list manager

Applications can run either in the foreground, where the user interacts with them, or in the background, where they perform tasks independently. A word processor is an example of a foreground task. The user starts a new document, types some text into it, formats it, and performs other tasks with it. A service, such as Windows Time, is an example of a background application. Windows Time can maintain time synchronization just fine without any user interaction.

However, the lines between foreground and background tasks aren't absolute. A word processor can employ a background task to print a document upon user request. The user can continue working in the foreground with the document while the word processor prints it in the background. Likewise, the W32Tm utility lets you interact with the Windows Time service. You might choose to resynchronize the local machine with an Internet time source, which means requesting the action from the Windows Time service, using the W32Tm utility.

Many of the examples in the book are necessarily foreground tasks because you want to see how a particular Windows 7 feature works. This chapter takes another approach to working with Windows 7. The sections that follow discuss background tasks and ...

Get Professional Windows 7 Development Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.