From cab2de6d24b2c9d396762db7cbec9249b750cf9b Mon Sep 17 00:00:00 2001 From: vdemydiuk Date: Fri, 9 Mar 2018 19:18:54 +0200 Subject: [PATCH] Issue #100: implemented functions GetLastError, ResetLastError() in MtApi (MT5) --- MT5Connector/MT5Connector.cpp | 2 +- MtApi5/Mt5CommandType.cs | 23 +++++++++++-- MtApi5/MtApi5Client.cs | 20 +++++++++++ TestClients/MtApi5TestClient/MainWindow.xaml | 32 +++++++++++++----- TestClients/MtApi5TestClient/ViewModel.cs | 16 +++++++++ mq5/MtApi5.ex5 | Bin 540774 -> 542352 bytes mq5/MtApi5.mq5 | 33 +++++++++++++++++++ 7 files changed, 113 insertions(+), 13 deletions(-) diff --git a/MT5Connector/MT5Connector.cpp b/MT5Connector/MT5Connector.cpp index d350c291..68dfe1f4 100755 --- a/MT5Connector/MT5Connector.cpp +++ b/MT5Connector/MT5Connector.cpp @@ -164,7 +164,7 @@ _DLLAPI int _stdcall sendStringResponse(int expertHandle, wchar_t* response, wch _DLLAPI int _stdcall sendVoidResponse(int expertHandle, wchar_t* err) { return Execute([&expertHandle]() { - MtAdapter::GetInstance()->SendResponse(expertHandle, nullptr); + MtAdapter::GetInstance()->SendResponse(expertHandle, gcnew MtResponseObject(nullptr)); return 1; }, err, 0); } diff --git a/MtApi5/Mt5CommandType.cs b/MtApi5/Mt5CommandType.cs index 22542cb8..07aa0851 100755 --- a/MtApi5/Mt5CommandType.cs +++ b/MtApi5/Mt5CommandType.cs @@ -107,8 +107,6 @@ namespace MtApi5 BacktestingReady = 66, IsTesting = 67, - Print = 68, - //Requests MtRequest = 155, @@ -179,6 +177,25 @@ namespace MtApi5 TimeLocal = 129, TimeGMT = 130, - IndicatorRelease = 131 + IndicatorRelease = 131, + + //Checkup + GetLastError = 132, + TerminalInfoInteger = 133, //TODO + TerminalInfoDouble = 134, //TODO + TerminalInfoString = 135, //TODO + + //Common Functions + Alert = 136, //TODO + Comment = 137, //TODO + GetTickCount = 138, //TODO + GetMicrosecondCount = 139, //TODO + MessageBox = 140, //TODO + PeriodSeconds = 141, //TODO + PlaySound = 142, //TODO + Print = 68, + ResetLastError = 143, + SendNotification = 144, //TODO + SendMail = 145 //TODO } } diff --git a/MtApi5/MtApi5Client.cs b/MtApi5/MtApi5Client.cs index cc4c0dda..295db5d2 100755 --- a/MtApi5/MtApi5Client.cs +++ b/MtApi5/MtApi5Client.cs @@ -2352,6 +2352,26 @@ namespace MtApi5 #endregion //Date and Time + #region Checkup + + /// + ///Returns the value of the last error that occurred during the execution of an mql5 program. + /// + public int GetLastError() + { + return SendCommand(Mt5CommandType.GetLastError, null); + } + + /// + ///Sets the value of the predefined variable _LastError into zero. + /// + public void ResetLastError() + { + SendCommand(Mt5CommandType.ResetLastError, null); + } + + #endregion + #endregion // Public Methods #region Properties diff --git a/TestClients/MtApi5TestClient/MainWindow.xaml b/TestClients/MtApi5TestClient/MainWindow.xaml index efe01736..44990044 100755 --- a/TestClients/MtApi5TestClient/MainWindow.xaml +++ b/TestClients/MtApi5TestClient/MainWindow.xaml @@ -294,15 +294,6 @@ Command="{Binding AccountInfoStringCommand}" Content="AccountInfoString" HorizontalAlignment="Left" /> - - - - - - - -