Prototype
long __cdecl fnHandleCustomEvent ( CustomEventInfo *pInfo );
Return value
1 if the plugin wants further custom events.
0 if no further custom events are needed.
All other return values are reserved for future use.
Parameters
pInfo
A pointer to a CustomEventInfo structure.
Remarks
This function is called from ShapeUp main executable when the loader plugin has signalled it needs to perform an update of the theme data. To raise such an event, the plugin should use the pfnRECB callback member of LoadShapeInfo parameter sent to fnLoadShapes, or supply a custom plug-in menu by implementing fnGetCustomMenu. To achieve the first, the plugin must have started an internal thread that checks for data changes from the external data source. Such a thread is normally started last thing in fnLoadShapes. If a thread like this is created, fnRemoveShapes should be implemented and exported. Make sure that the thread has exited before fnRemoveShapes exits.
Notice: If using MFC, be sure to start the function with AFX_MANAGE_STATE(AfxGetStaticModuleState());
Example
/* This is our data collecting thread */ void __cdecl WorkerThread(void * pIndata) { WorkThreadData *pwtd = (WORKTHREADDATA*) pIndata; while (pwtd->bRunThread) { /* Check if data has changed */ if (CheckData(pIndata->ulThemeKey)) { unsigned long ulUpdateHint = MY_EVENT_1; /* We are not allowed to modify data here so * we use the Request Event Callback */ (*pwtd->pfnRECB)(pwtd->ulSessionData, ulUpdateHint); } } } /* This is our custom event handler */ long __cdecl fnHandleCustomEvent ( CustomEventInfo *pInfo ) { switch(pInfo->ulEventHint) { case MY_EVENT_1: break; case MY_EVENT_2: break; default: break; } return 1; }
See Also
Loader API, CustomEventInfo , fnLoadShapes, LoadShapeInfo, fnRemoveShapes, fnGetCustomMenu