Share via


_ActivateIdle( ) (Rutina de biblioteca API)

Agrega una función de controlador inactivo al final de la lista de controladores de eventos inactivos cuando Visual FoxPro espera una entrada del usuario o un evento de fin de tiempo de espera.

unsigned int _ActivateIdle(FPFI handler) 
FPFI handler               /* Event handler. */

Observaciones

_ActivateIdle( ) devuelve un entero identificador de esta rutina. Utilice el identificador para quitar el controlador de eventos inactivo del bucle inactivo _DeActivateIdle( ).

Para obtener más información acerca de cómo crear una biblioteca API e integrarla con Visual FoxPro, vea Acceso a la API de Visual FoxPro.

Ejemplo

El siguiente ejemplo activa un controlador de eventos inactivo cuando se carga la biblioteca. El controlador de eventos inactivo imprime en ese momento un mensaje. El controlador de eventos inactivo se desactiva cuando la biblioteca se descarga.

Código Visual FoxPro

SET LIBRARY TO ACTIIDLE
WAIT WINDOW TO m.test TIMEOUT 5
SET LIBRARY TO

Código C

#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 
//   handlerin 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
};

Vea también

_DeActivateIdle( ) (Rutina de biblioteca API) | _FindWindow( ) (Rutina de biblioteca API) | _GlobalToLocal( ) (Rutina de biblioteca API) | _MousePos( ) (Rutina de biblioteca API) | Controladores de eventos | EventHandler( ) (Función)