Condividi tramite


_DeActivateIdle( ) API Library Routine

Removes the specified routine from the idle loop.

void _DeActivateIdle(unsigned int IdleIdentifier)
unsigned int IdleIdentifier;         /* Routine to be removed
 from idle list. */

Remarks

You must remove each idle routine from the idle routine list when its library is unloaded.

For more information on how to create an API library and integrate it with Visual FoxPro, see Accessing the Visual FoxPro API.

Example

The following example activates an idle event handler when the library is loaded. The idle event handler simply prints a message and is deactivated when the library is unloaded. As in the following example, _DeActivateIdle( ) is usually called from a CALLONUNLOAD function.

Visual FoxPro Code

SET LIBRARY TO DEACTIDL

C Code

#include <pro_ext.h>

static unsigned IdlerID;

//   This is the routine that is registered as an idle event handler.
void FAR IdleHandler(WHandle wh, EventRec *ev)
{
   _PutStr("\nIdleHandler() called.");
}

void FAR Activate(ParamBlk FAR *parm)
{
   IdlerID = _ActivateIdle((FPFI) IdleHandler);
}

//   When the library is unloaded we must deactivate the idle event 
//   handler in a CALLONUNLOAD function.
void FAR DeActivate(ParamBlk FAR *parm)
{
   _DeActivateIdle(IdlerID);
}

FoxInfo myFoxInfo[] = {
   {"ACTIVATE",  (FPFI) Activate, CALLONLOAD,   ""},
   {"DEACTIVATE",  (FPFI) DeActivate, CALLONUNLOAD, ""}
};
FoxTable _FoxTable = {
   (FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo
};

See Also

_ActivateIdle( ) API Library Routine | _FindWindow( ) API Library Routine | _GlobalToLocal( ) API Library Routine | _MousePos( ) API Library Routine