IDirectInputEffect::Initialize

The IDirectInputEffect::Initialize method initializes a DirectInputEffect object.

HRESULT Initialize(
  HINSTANCE hinst,  
  DWORD dwVersion,  
  REFGUID rguid     
);
 

Parameters

hinst
Instance handle to the application or DLL that is creating the DirectInputEffect object. DirectInput uses this value to determine whether the application or DLL has been certified and to establish any special behaviors that may be necessary for backwards compatibility. It is an error for a DLL to pass the handle to the parent application.
dwVersion
Version number of DirectInput for which the application is designed. This value will normally be DIRECTINPUT_VERSION. Passing the version number of a previous version will cause DirectInput to emulate that version. For more information, see Designing for Previous Versions of DirectInput.
rguid
Identifier of the effect with which the interface is associated. The IDirectInputDevice2::EnumEffects method can be used to determine which effect GUIDs are supported by the device.

Return Values

If the method succeeds, the return value is DI_OK.

If the method fails, the return value may be DIERR_DEVICENOTREG.

Remarks

If this method fails, the underlying object should be considered to be an indeterminate state and needs to be reinitialized before it can be subsequently used.

The IDirectInputDevice2::CreateEffect method automatically initializes the effect after creating it. Applications normally do not need to call the Initialize method.

In C++ the rguid parameter must be passed by reference; in C, which does not have pass-by-reference, it must be passed by address. The following is an example of a C++ call:

lpeff->Initialize(g_hinstDll, DIRECTINPUT_VERSION, GUID_Effect);
 

The following shows the same call in C:

lpeff->lpVtbl->Initialize(lpeff, g_hinstDll, 
                          DIRECTINPUT_VERSION, &GUID_Effect);
 

QuickInfo

  Windows NT/2000: Requires Windows 2000.
  Windows 95/98: Requires Windows 95 or later. Available as a redistributable for Windows 95.
  Header: Declared in dinput.h.
  Import Library: Use dinput.lib.