Microsoft DirectX 9.0

IDirectInputDevice8::CreateEffect Method

Creates and initializes an instance of an effect identified by the effect globally unique identifier (GUID).


HRESULT CreateEffect(      

    REFGUID rguid,     LPCDIEFFECT lpeff,     LPDIRECTINPUTEFFECT *ppdeff,     LPUNKNOWN punkOuter );


Reference to (C++) or address of (C) the GUID identifying the effect to be created. This can be a predefined effect GUID, or it can be a GUID obtained from IDirectInputDevice8::EnumEffects. The following standard effect GUIDs are defined:
  • GUID_ConstantForce
  • GUID_RampForce
  • GUID_Square
  • GUID_Sine
  • GUID_Triangle
  • GUID_SawtoothUp
  • GUID_SawtoothDown
  • GUID_Spring
  • GUID_Damper
  • GUID_Inertia
  • GUID_Friction
  • GUID_CustomForce
DIEFFECT structure that provides parameters for the created effect. This parameter is optional. If it is NULL, the effect object is created without parameters. The application must then call the IDirectInputEffect::SetParameters method to set the parameters of the effect before it can download the effect.
Address of a variable to receive a pointer to the IDirectInputEffect interface if successful.
Controlling unknown for Component Object Model (COM) aggregation. The value is NULL if the interface is not aggregated. Most callers pass NULL.

Return Value

If the method succeeds, the return value is DI_OK.

If the method fails, the return value can be one of the following error values:

DIERR_DEVICEFULLThe device is full.
DIERR_DEVICENOTREGThe device or device instance is not registered with Microsoft?DirectInput? This value is equal to the REGDB_E_CLASSNOTREG standard COM return value.
DIERR_INVALIDPARAMAn invalid parameter was passed to the returning function, or the object was not in a state that permitted the function to be called. This value is equal to the E_INVALIDARG standard COM return value.
DIERR_NOTINITIALIZEDThe object has not been initialized.


If the return value is S_OK, the effect was created, and the parameters of the effect were updated, but the effect was not necessarily downloaded. For it to be downloaded, the device must be acquired in exclusive mode.

© 2002 Microsoft Corporation. All rights reserved.