Using the MAPI Idle Engine

If users perceive a delay while your application performs processing that is not time-critical, you can defer the processing until a time when it will not be noticed. Use the MAPI idle engine as a strategy to delay performing the operation.

The MAPI idle engine is a set of functions that can improve performance by making good use of idle time.

    To use the MAPI idle engine
  1. Create a callback function that contains tasks that can occur when the MAPI subsystem is idle.
  2. Defer processing by registering the task as an idle task.

When MAPI detects idle time, it executes this task by invoking your callback function. For more information, see the MAPI Programmer’s Reference.

Example: Timing Status Bar Use

A Microsoft Exchange Client application moves and deletes messages slowly enough that the delay is noticeable to users. It spends too much time getting and processing notifications, then updating the status bar display. To accelerate these operations, the application is redesigned to use the status bar only after a two-second delay if the process is still running.

After this change, when a user deletes a single message, the response is much faster. If multiple messages are deleted and the process takes longer than two seconds, the status bar provides information about the continuing process. This modification saves time and increases feedback to users for both large and small operations.

Example: Optimizing Application Startup

A Microsoft Exchange Client application starts slowly because it invokes a large number of MAPI methods on startup. To improve this application’s startup time, some of the MAPI calls are deferred until after the application starts and the user interface displays. User interaction often generates idle time, so deferred calls will usually be made transparently to the user.