#ifndef TDx9_InputDeviceH #define TDx9_InputDeviceH // ========================================================================== // File: TDx9_InputDevice.H // Authors: BCB_Code_Generator v2.00, // Darren Dwyer (source code, documentation, demos, website), // Hugh Edwards (documentation, icons) // Description: This file defines the TDx9_InputDevice Component // // "TDx9_Input_Library v1.00" // (c) 2005 BCB-Tools.com Pty. Ltd., Sydney, Australia. // All Rights Reserved. // // Refer to the 'Licence.Txt' file for licencing & copyright information. // ========================================================================== // -------------------------------------------------------------------------- #include "TDx_Library_Defns.H" #include "TDx_Library_Functions.H" // -------------------------------------------------------------------------- #include "TDx9_Input_Library_Defns.H" #include "TDx9_Input_Library_Functions.H" // -------------------------------------------------------------------------- // external classes used by TDx9_InputDevice methods. class TDIActionFormat; class TDIEffect; class TDx_InputEffect; class TDIEffEscape; class TDIDevCaps; class TDIDeviceObjectData; class TDIDeviceInstance; class TDIEffectInfo; class TDIDeviceImageInfoHeader; class TDIDeviceObjectInstance; class TDIPropHeader; class TDIDataFormat; class TDIFileEffect; // -------------------------------------------------------------------------- // ========================================================================== // Class: TDx9_InputDevice // Description: The TDx9_InputDevice object is used to ... // ========================================================================== #if (__BORLANDC__ >= 0x0530) // BCB Version 3 + class PACKAGE TDx9_InputDevice : public TComponent { // -------------------------------------------------------------------------- #else // BCB Version 1 class TDx9_InputDevice : public TComponent { #endif // ========================================================================== __published: // ========================================================================== // ---------------------------------------------------------------------- // Event: OnCreate() // Description: The OnCreate() event is triggered by the // TDx9_InputDevice::Create() method after it has // successfully created the internal LPDIRECTINPUTDEVICE8 // used within the TDx9_InputDevice component. // // Note that since this event is only called upon successful // creation, this event is an ideal place for code that is // to be activated only once, immediately upon the // successful creation of the LPDIRECTINPUTDEVICE8 // interface. // // For example, you could retrieve the TDx9_InputDevice // component's capabilities, Create() dependant components, // allocate memory, etc. // // When used in conjunction with the // TDx9_InputDevice::OnDestroy() event, you can fully // automate and insulate your code on a per-component basis. // ---------------------------------------------------------------------- __property TDx_Event OnCreate = {read=FOnCreate, write=FOnCreate, nodefault}; // ---------------------------------------------------------------------- // Event: OnDestroy() // Description: The OnDestroy() event is triggered by the // TDx9_InputDevice::Destroy() method, just before the // TDx9_InputDevice internal LPDIRECTINPUTDEVICE8 interface // is destroyed. // // Note: This event is an ideal place to place code that // reverses the results of the TDx9_InputDevice::OnCreate() // event. For example, assume you have already setup the // TDx9_InputDevice::OnCreate() event to retrieve the // component's capabilities, Create() a dependant component // and allocate some memory; // You can then fully automate and insulate your code on a // per-component basis by placing code in the // TDx9_InputDevice::OnDestroy() event to deallocate memory, // Destroy() the dependant components and, when required, // destroy the capabilities component. // ---------------------------------------------------------------------- __property TDx_Event OnDestroy = {read=FOnDestroy, write=FOnDestroy, nodefault}; // ---------------------------------------------------------------------- // Event: OnError() // Description: The OnError event is called when an error occurs in the // TDx9_InputDevice component. // ---------------------------------------------------------------------- __property TDx_Error OnError = {read=FOnError, write=FOnError, nodefault}; // ========================================================================== public: // ========================================================================== // ---------------------------------------------------------------------- // Property: Created // Description: The Created property is true if the internal // LPDIRECTINPUTDEVICE8 used in this component has been // successfully created, otherwise Created is false. // // To create the internal LPDIRECTINPUTDEVICE8, call the // TDx9_InputDevice::Create() method. // ---------------------------------------------------------------------- __property bool Created = { read=FGetCreated, write=FSetCreated, default=false }; // ---------------------------------------------------------------------- // Property: ErrorValue // Description: The ErrorValue property contains the last error value // returned from a call to a TDx9_InputDevice method or // fget/fset. eg. DI_OK or DDERR_SURFACELOST or TDX_ERROR // ---------------------------------------------------------------------- __property HRESULT ErrorValue = { read=FGetErrorValue, write=FSetErrorValue, default=DI_OK }; // ---------------------------------------------------------------------- // Method: Acquire() // Description: The Acquire method is used to ... // ---------------------------------------------------------------------- virtual bool __fastcall Acquire(); // ---------------------------------------------------------------------- // Method: BuildActionMap() // Description: The BuildActionMap method is used to ... // Params: plpdiaf - // The lpdiaf parameter ... // pUserName - // The UserName parameter ... // pFlags - // The Flags parameter ... // ---------------------------------------------------------------------- virtual bool __fastcall BuildActionMap( TDIActionFormat* plpdiaf, AnsiString* pUserName, dword pFlags ); // ---------------------------------------------------------------------- // Method: Create() // Description: The Create() method is used to automatically create the // internal LPDIRECTINPUTDEVICE8 interface used in the // TDx9_InputDevice component and must be called before any // methods of the TDx9_InputDevice component will function. // ---------------------------------------------------------------------- virtual bool __fastcall Create(); // ---------------------------------------------------------------------- // Method: CreateEffect() // Description: The CreateEffect method is used to ... // Params: prguid - // The rguid parameter ... // plpeff - // The lpeff parameter ... // p*ppdeff - // The *ppdeff parameter ... // pOuter - // The Outer parameter ... // ---------------------------------------------------------------------- virtual bool __fastcall CreateEffect( REFGUID prguid, TDIEffect* plpeff, TDx_InputEffect* p*ppdeff, LPUNKNOWN pOuter ); // ---------------------------------------------------------------------- // Method: Destroy() // Description: The Destroy() method is used to automatically destroy the // internal LPDIRECTINPUTDEVICE8 interface used in the // TDx9_InputDevice component and should be called when the // internal interface is no longer required. // // Note: This method is called by the component's // destructor. // ---------------------------------------------------------------------- virtual bool __fastcall Destroy(); // ---------------------------------------------------------------------- // Method: EnumCreatedEffectObjects() // Description: The EnumCreatedEffectObjects method is used to ... // Params: pRef - // The Ref parameter ... // pfl - // The fl parameter ... // ---------------------------------------------------------------------- virtual bool __fastcall EnumCreatedEffectObjects( void* pRef, dword pfl ); // ---------------------------------------------------------------------- // Method: EnumEffects() // Description: The EnumEffects method is used to ... // Params: pRef - // The Ref parameter ... // pEffType - // The EffType parameter ... // ---------------------------------------------------------------------- virtual bool __fastcall EnumEffects( void* pRef, dword pEffType ); // ---------------------------------------------------------------------- // Method: EnumEffectsInFile() // Description: The EnumEffectsInFile method is used to ... // Params: pFileName - // The FileName parameter ... // pRef - // The Ref parameter ... // pFlags - // The Flags parameter ... // ---------------------------------------------------------------------- virtual bool __fastcall EnumEffectsInFile( AnsiString* pFileName, void* pRef, dword pFlags ); // ---------------------------------------------------------------------- // Method: EnumObjects() // Description: The EnumObjects method is used to ... // Params: pRef - // The Ref parameter ... // pFlags - // The Flags parameter ... // ---------------------------------------------------------------------- virtual bool __fastcall EnumObjects( void* pRef, dword pFlags ); // ---------------------------------------------------------------------- // Method: Escape() // Description: The Escape method is used to ... // Params: ppesc - // The pesc parameter ... // ---------------------------------------------------------------------- virtual bool __fastcall Escape( TDIEffEscape* ppesc ); // ---------------------------------------------------------------------- // Method: GetCapabilities() // Description: The GetCapabilities method is used to ... // Params: pDIDevCaps - // The DIDevCaps parameter ... // ---------------------------------------------------------------------- virtual bool __fastcall GetCapabilities( TDIDevCaps* pDIDevCaps ); // ---------------------------------------------------------------------- // Method: GetDeviceData() // Description: The GetDeviceData method is used to ... // Params: pObjectData - // The ObjectData parameter ... // prgdod - // The rgdod parameter ... // pInOut - // The InOut parameter ... // pFlags - // The Flags parameter ... // ---------------------------------------------------------------------- virtual bool __fastcall GetDeviceData( dword pObjectData, TDIDeviceObjectData* prgdod, dword* pInOut, dword pFlags ); // ---------------------------------------------------------------------- // Method: GetDeviceInfo() // Description: The GetDeviceInfo method is used to ... // Params: ppdidi - // The pdidi parameter ... // ---------------------------------------------------------------------- virtual bool __fastcall GetDeviceInfo( TDIDeviceInstance* ppdidi ); // ---------------------------------------------------------------------- // Method: GetDeviceState() // Description: The GetDeviceState method is used to ... // Params: pData - // The Data parameter ... // ---------------------------------------------------------------------- // ---------------------------------------------------------------------- // Method: GetEffectInfo() // Description: The GetEffectInfo method is used to ... // Params: ppdei - // The pdei parameter ... // prguid - // The rguid parameter ... // ---------------------------------------------------------------------- virtual bool __fastcall GetEffectInfo( TDIEffectInfo* ppdei, REFGUID prguid ); // ---------------------------------------------------------------------- // Method: GetForceFeedbackState() // Description: The GetForceFeedbackState method is used to ... // Params: pOut - // The Out parameter ... // ---------------------------------------------------------------------- virtual bool __fastcall GetForceFeedbackState( dword* pOut ); // ---------------------------------------------------------------------- // Method: GetImageInfo() // Description: The GetImageInfo method is used to ... // Params: pDevImageInfoHeader - // The DevImageInfoHeader parameter ... // ---------------------------------------------------------------------- virtual bool __fastcall GetImageInfo( TDIDeviceImageInfoHeader* pDevImageInfoHeader ); // ---------------------------------------------------------------------- // Method: GetObjectInfo() // Description: The GetObjectInfo method is used to ... // Params: ppdidoi - // The pdidoi parameter ... // pObj - // The Obj parameter ... // pHow - // The How parameter ... // ---------------------------------------------------------------------- virtual bool __fastcall GetObjectInfo( TDIDeviceObjectInstance* ppdidoi, dword pObj, dword pHow ); // ---------------------------------------------------------------------- // Method: GetProperty() // Description: The GetProperty method is used to ... // Params: pProp - // The Prop parameter ... // ppdiph - // The pdiph parameter ... // ---------------------------------------------------------------------- virtual bool __fastcall GetProperty( REFGUID pProp, TDIPropHeader* ppdiph ); // ---------------------------------------------------------------------- // Method: Initialize() // Description: The Initialize method is used to ... // Params: phinst - // The hinst parameter ... // pVersion - // The Version parameter ... // prguid - // The rguid parameter ... // ---------------------------------------------------------------------- virtual bool __fastcall Initialize( HINSTANCE phinst, dword pVersion, REFGUID prguid ); // ---------------------------------------------------------------------- // Method: Poll() // Description: The Poll method is used to ... // ---------------------------------------------------------------------- virtual bool __fastcall Poll(); // ---------------------------------------------------------------------- // Method: RunControlPanel() // Description: The RunControlPanel method is used to ... // Params: pOwner - // The Owner parameter ... // pFlags - // The Flags parameter ... // ---------------------------------------------------------------------- virtual bool __fastcall RunControlPanel( HWND pOwner, dword pFlags ); // ---------------------------------------------------------------------- // Method: SendDeviceData() // Description: The SendDeviceData method is used to ... // Params: pObjectData - // The ObjectData parameter ... // prgdod - // The rgdod parameter ... // pInOut - // The InOut parameter ... // pfl - // The fl parameter ... // ---------------------------------------------------------------------- virtual bool __fastcall SendDeviceData( dword pObjectData, TDIDeviceObjectData* prgdod, dword* pInOut, dword pfl ); // ---------------------------------------------------------------------- // Method: SendForceFeedbackCommand() // Description: The SendForceFeedbackCommand method is used to ... // Params: pFlags - // The Flags parameter ... // ---------------------------------------------------------------------- virtual bool __fastcall SendForceFeedbackCommand( dword pFlags ); // ---------------------------------------------------------------------- // Method: SetActionMap() // Description: The SetActionMap method is used to ... // Params: pActionFormat - // The ActionFormat parameter ... // pUserName - // The UserName parameter ... // pFlags - // The Flags parameter ... // ---------------------------------------------------------------------- virtual bool __fastcall SetActionMap( TDIActionFormat* pActionFormat, AnsiString* pUserName, dword pFlags ); // ---------------------------------------------------------------------- // Method: SetCooperativeLevel() // Description: The SetCooperativeLevel method is used to ... // Params: phwnd - // The hwnd parameter ... // pFlags - // The Flags parameter ... // ---------------------------------------------------------------------- virtual bool __fastcall SetCooperativeLevel( HWND phwnd, dword pFlags ); // ---------------------------------------------------------------------- // Method: SetDataFormat() // Description: The SetDataFormat method is used to ... // Params: plpdf - // The lpdf parameter ... // ---------------------------------------------------------------------- virtual bool __fastcall SetDataFormat( TDIDataFormat* plpdf ); // ---------------------------------------------------------------------- // Method: SetEventNotification() // Description: The SetEventNotification method is used to ... // Params: pEvent - // The Event parameter ... // ---------------------------------------------------------------------- virtual bool __fastcall SetEventNotification( HANDLE pEvent ); // ---------------------------------------------------------------------- // Method: SetProperty() // Description: The SetProperty method is used to ... // Params: pProp - // The Prop parameter ... // ppdiph - // The pdiph parameter ... // ---------------------------------------------------------------------- virtual bool __fastcall SetProperty( REFGUID pProp, TDIPropHeader* ppdiph ); // ---------------------------------------------------------------------- // Method: Unacquire() // Description: The Unacquire method is used to ... // ---------------------------------------------------------------------- virtual bool __fastcall Unacquire(); // ---------------------------------------------------------------------- // Method: WriteEffectToFile() // Description: The WriteEffectToFile method is used to ... // Params: pFileName - // The FileName parameter ... // pEntries - // The Entries parameter ... // pDiFileEft - // The DiFileEft parameter ... // pFlags - // The Flags parameter ... // ---------------------------------------------------------------------- virtual bool __fastcall WriteEffectToFile( AnsiString* pFileName, dword pEntries, TDIFileEffect* pDiFileEft, dword pFlags ); // ---------------------------------------------------------------------- // Constructor() and Destructor() // ---------------------------------------------------------------------- __fastcall TDx9_InputDevice(TComponent* Owner); virtual __fastcall ~TDx9_InputDevice(); // ---------------------------------------------------------------------- // The following properties and methods are used internally by // TDx9_Input_Library and should not be used. // ---------------------------------------------------------------------- __property LPDIRECTINPUTDEVICE8 Internal_LPDIRECTINPUTDEVICE8 = { read=FGetInternal_LPDIRECTINPUTDEVICE8, write=FSetInternal_LPDIRECTINPUTDEVICE8, nodefault }; __property LPDIRECTINPUTDEVICE8* Internal_LPDIRECTINPUTDEVICE8_Ptr = { read=FGetInternal_LPDIRECTINPUTDEVICE8_Ptr, nodefault }; void __fastcall Internal_LPDIRECTINPUTDEVICE8_Update(); // ========================================================================== protected: // ========================================================================== // ---------------------------------------------------------------------- // Property Access Methods // ---------------------------------------------------------------------- bool __fastcall FGetCreated(); void __fastcall FSetCreated( bool pCreated ); HRESULT __fastcall FGetErrorValue(); void __fastcall FSetErrorValue( HRESULT pErrorValue ); // ========================================================================== private: // ========================================================================== // ---------------------------------------------------------------------- // Internal Interface Access // ---------------------------------------------------------------------- LPDIRECTINPUTDEVICE8 __fastcall FGetInternal_LPDIRECTINPUTDEVICE8(); void __fastcall FSetInternal_LPDIRECTINPUTDEVICE8( LPDIRECTINPUTDEVICE8 pLPDIRECTINPUTDEVICE8 ); LPDIRECTINPUTDEVICE8* __fastcall FGetInternal_LPDIRECTINPUTDEVICE8_Ptr(); // ---------------------------------------------------------------------- // Property Variables // ---------------------------------------------------------------------- bool fCreated; HRESULT fErrorValue; // ---------------------------------------------------------------------- // Interface Variables // ---------------------------------------------------------------------- LPDIRECTINPUTDEVICE8 fLPDIRECTINPUTDEVICE8; // ---------------------------------------------------------------------- // Event Variables // ---------------------------------------------------------------------- TDx_Event FOnCreate; TDx_Event FOnDestroy; TDx_Error FOnError; }; // -------------------------------------------------------------------------- #endif // --------------------------------------------------------------------------