_DeActivateHandler( ) API Library Routine
_DeActivateHandler( ) removes the specified event handler from the event processor list.
void _DeActivateHandler(unsigned int EventIdentifier)
unsigned int EventIdentifier; /* ID of event handler
to be removed from list. */
Remarks
You must remove each event handler, indicated by EventIdentifier, from the handler 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 event handler when the library is loaded. The event handler prints a message for every event and lets Visual FoxPro process the message. The event handler is deactivated when the library is unloaded. As in the following example, _DeActivateHandler( ) is usually called from a CALLONUNLOAD function.
Visual FoxPro Code
SET LIBRARY TO DEACTHAN
C Code
#include <pro_ext.h>
static int HandlerID;
// This is the routine that is registered as an event handler.
FAR EventHandler(WHandle theWindow, EventRec FAR *ev)
{
_PutStr("\nEventHandler() called.");
return NO; // event still needs to be handled by Visual FoxPro
}
FAR Activate()
{
HandlerID = _ActivateHandler(EventHandler);
}
// When the library is unloaded we must deactivate the event handler
// in a CALLONUNLOAD function.
FAR DeActivate()
{
_DeActivateHandler(HandlerID);
}
FoxInfo myFoxInfo[] = {
{"ACTIVATE", (FPFI) Activate, CALLONLOAD, ""},
{"DEACTIVATE", (FPFI) DeActivate, CALLONUNLOAD, ""}
};
FoxTable _FoxTable = {
(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo
};
See Also
Concepts
Reference
_ActivateHandler( ) API Library Routine
_FindWindow( ) API Library Routine
_GlobalToLocal( ) API Library Routine
_MousePos( ) API Library Routine