Adds an idle handler function to the end of the list of idle event handlers called when Visual FoxPro is waiting for user input or for an event to time out.
|
|---|
unsigned int _ActivateIdle(FPFI handler)
FPFI handler /* Event handler. */ |
Remarks
Example
The following example activates an idle event handler when the library is loaded. The idle event handler just prints a message. The idle event handler is deactivated when the library is unloaded.
Visual FoxPro Code
| | Copy Code |
|---|
SET LIBRARY TO ACTIIDLE
WAIT WINDOW TO m.test TIMEOUT 5
SET LIBRARY TO |
C Code
| | Copy 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
}; |
See Also