FtgRegisterIdleRoutine

The FtgRegisterIdleRoutine function adds a FNIDLE – based idle routine to the MAPI system.

Note This function may not be supported in future versions of MAPI.

Quick Info

Header file: MAPIUTIL.H
Implemented by: MAPI
Called by: Client applications and service providers

FTG FtgRegisterIdleRoutine(
  PFNIDLE pfnIdle,      
  LPVOID pvIdleParam,   
  short priIdle,        
  ULONG csecIdle,       
  USHORT iroIdle        
);
 

Parameters

pfnIdle
[in] Pointer to the idle routine.
pvIdleParam
[in] Pointer to a block of memory that the idle engine should pass as a parameter to the idle routine when it calls it.
priIdle
[in] Initial priority for the idle routine. Possible priorities for implementation-defined routines are greater than or less than zero, but not zero. The zero priority is reserved for a user event such as a mouse click or a WM_PAINT message.

Priorities greater than zero represent background tasks that have a higher priority than user events and are dispatched as part of the standard Windows message pump loop. Priorities less than zero represent idle tasks that only run during message pump idle time. Examples of priorities are: 1 for foreground submission, –1 for power-edit character insertion, and –3 for downloading new messages.

csecIdle
[in] Initial time value, in hundredths of a second, to be used in specifying idle routine parameters. The meaning of the initial time value varies, depending on what is passed in the iroIdle parameter. It can be:
iroIdle
[in] Bitmask of flags used to set initial options for the idle routine. Exactly one of the following flags must be set:
FIRODISABLED
The idle routine is to be initially disabled when registered. The default action is to enable the idle routine when FtgRegisterIdleRoutine registers it.
FIROINTERVAL
The time specified by the csecIdle parameter is the minimum interval between successive calls to the idle routine.
FIROONCEONLY
Obsolete. Do not use.
FIROPERBLOCK
Obsolete. Do not use.
FIROWAIT
The time specified by the csecIdle parameter is the minimum period of user inaction that must elapse before the MAPI idle engine calls the idle routine for the first time. After this time passes, the idle engine can call the idle routine as often as necessary.

Remarks

The FtgRegisterIdleRoutine function returns a function tag identifying the idle routine that has been added to the MAPI system. If FtgRegisterIdleRoutine cannot register the idle routine for the client application or service provider — for example, because of memory problems — it returns NULL.

The following functions deal with the MAPI idle engine and with idle routines based on the FNIDLE function prototype:

Idle routine function Usage
ChangeIdleRoutine Changes the characteristics of a registered idle routine.
DeregisterIdleRoutine Removes a registered idle routine from the MAPI system.
EnableIdleRoutine Disables or re-enables a registered idle routine without removing it from the MAPI system.
FtgRegisterIdleRoutine Adds an idle routine to the MAPI system, with or without enabling it.
MAPIDeInitIdle Shuts down the MAPI idle engine for the calling application.
MAPIInitIdle Initializes the MAPI idle engine for the calling application.

ChangeIdleRoutine, DeregisterIdleRoutine, and EnableIdleRoutine take as an input parameter the function tag returned by FtgRegisterIdleRoutine.

When all foreground tasks for the platform become idle, the MAPI idle engine calls the highest priority idle routine that is ready to execute. There is no guarantee of calling order among idle routines of the same priority.

See Also

Idle Routine Functions