//+------------------------------------------------------------------+ //| DXInput.mqh | //| Copyright 2000-2025, MetaQuotes Ltd. | //| https://www.mql5.com | //+------------------------------------------------------------------+ #include "DXHandle.mqh" //+------------------------------------------------------------------+ //| Class CDXInput | //+------------------------------------------------------------------+ class CDXInput : public CDXHandleShared { public: //+------------------------------------------------------------------+ //| Destructor | //+------------------------------------------------------------------+ virtual ~CDXInput(void) { Shutdown(); } //+------------------------------------------------------------------+ //| Create a new input buffer | //+------------------------------------------------------------------+ template bool Create(int context) { //--- shutdown input Shutdown(); //--- save new context m_context=context; //--- create new input buffer m_handle=DXInputCreate(m_context,sizeof(TInput)); return(m_handle!=INVALID_HANDLE); } //+------------------------------------------------------------------+ //| Set input data | //+------------------------------------------------------------------+ template bool InputSet(const TInput &input_data) { //--- check input handle if(m_handle==INVALID_HANDLE) return(false); //--- set input data return(DXInputSet(m_handle,input_data)); } //+------------------------------------------------------------------+ //| Shutdown | //+------------------------------------------------------------------+ virtual void Shutdown(void) { //--- relase handle if(m_handle!=INVALID_HANDLE) DXRelease(m_handle); m_handle=INVALID_HANDLE; } }; //+------------------------------------------------------------------+