DirectX SDK

Effect Object Enumeration

[Visual Basic]

This topic pertains only to applications developed in C++. DirectX for Visual Basic does not support enumeration of created effects.

[C++]

Whenever you need to examine or manipulate all the effects you have created, use the IDirectInputDevice7::EnumCreatedEffectObjects method. Since no flags are currently defined for this method, you cannot restrict the enumeration to particular kinds of effects; all effects are 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 DIEnumCreatedEffectObjectsCallback, but you can use a different name. The function is called for each effect enumerated. Within the function you can perform any processing that you want; however, it is not safe to create a new effect while enumeration is going on.

The following is a code example of the callback function and the call to the EnumCreatedEffectObjects method. 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 DIEnumCreatedEffectObjectsCallback(
                     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 in motion.
hr = lpdid->EnumCreatedEffectObjects(&EnumCreatedEffectObjectsCallback,
                                     &lpdid, 0);