Whenever you need to examine or manipulate all the effects you have created, you can use the IDirectInputDevice2::EnumCreatedEffectObjects method. As no flags are currently defined for this method, you cannot restrict the enumeration to particular kinds of effects; all effects will be enumerated.
Note This method enumerates created effects, not effects supported by a device. For more information on the distinction between the two, see Effect Enumeration.
Like other DirectInput enumerations, the EnumCreatedEffectObjects method requires a callback function. This standard callback is documented with the placeholder name DIEnumCreatedEffectObjectsProc, but you can use a different name. The function is called for each effect enumerated. Within the function you can perform any processing you want; however, it is not safe to create a new effect while enumeration is going on.
Here is a skeletal C++ example of the callback function, and the call to the EnumCreatedEffectObjects method. Note that the pvRef parameter of the callback can be any 32-bit value; in this case it is a pointer to the device interface.
HRESULT hr;
// LPDIRECTINPUTDEVICE lpdid; // already initialized
BOOL CALLBACK DIEnumCreatedEffectObjectsProc(
LPDIRECTINPUTEFFECT peff, LPVOID pvRef);
{
LPDIRECTINPUTDEVICE pdid = pvRef; // pointer to calling device
DIEFFECT diEffect; // params for created effect
diEffect.dwSize = sizeof(DIEFFECTINFO);
peff->GetParameters(&diEffect, DIEP_ALLPARAMS);
// check or set parameters, or do anything else
.
.
.
} // end of callback
// Set the callback into motion
hr = lpdid->EnumCreatedEffectObjects(&EnumCreatedEffectObjectsProc,
&lpdid, 0);