_ActivateIdle( ), API-Bibliotheksroutine

Fügt eine Leerlaufbehandlungsfunktion am Ende der Liste mit den Leerlauf-Ereignisbehandlungsroutinen hinzu, die aufgerufen werden, wenn Visual FoxPro auf eine Benutzereingabe oder auf die Zeitüberschreitung für ein Ereignis wartet.

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

Hinweise

_ActivateIdle( ) gibt ein ganzzahliges Handle für diese Routine zurück. Verwenden Sie das Handle, um die Leerlauf-Ereignisbehandlungsroutine mit _DeActivateIdle( ) aus der Leerlaufschleife zu entfernen.

Weitere Informationen zum Erstellen einer API-Bibliothek und ihrer Integration in Visual FoxPro finden Sie unter Zugreifen auf die Visual FoxPro-API.

Beispiel

Im folgenden Beispiel wird beim Laden der Bibliothek eine Leerlauf-Ereignisbehandlungsroutine aktiviert. Die Leerlauf-Ereignisbehandlungsroutine druckt lediglich eine Meldung. Die Leerlauf-Ereignisbehandlungsroutine wird beim Entfernen der Bibliothek deaktiviert.

Visual FoxPro-Code

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

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

Siehe auch

_DeActivateIdle( ), API-Bibliotheksroutine | _FindWindow( ), API-Bibliotheksroutine | _GlobalToLocal( ), API-Bibliotheksroutine | _MousePos( ), API-Bibliotheksroutine | Ereignishandler | EventHandler( )-Funktion