mirror of
https://github.com/vdemydiuk/mtapi.git
synced 2026-08-16 04:08:10 +00:00
Update MT5Connector project for using MtService
This commit is contained in:
@@ -1,38 +0,0 @@
|
|||||||
#include "stdafx.h"
|
|
||||||
|
|
||||||
using namespace System;
|
|
||||||
using namespace System::Reflection;
|
|
||||||
using namespace System::Runtime::CompilerServices;
|
|
||||||
using namespace System::Runtime::InteropServices;
|
|
||||||
using namespace System::Security::Permissions;
|
|
||||||
|
|
||||||
//
|
|
||||||
// General Information about an assembly is controlled through the following
|
|
||||||
// set of attributes. Change these attribute values to modify the information
|
|
||||||
// associated with an assembly.
|
|
||||||
//
|
|
||||||
[assembly:AssemblyTitleAttribute("MT5Connector")];
|
|
||||||
[assembly:AssemblyDescriptionAttribute("")];
|
|
||||||
[assembly:AssemblyConfigurationAttribute("")];
|
|
||||||
[assembly:AssemblyCompanyAttribute("")];
|
|
||||||
[assembly:AssemblyProductAttribute("MT5Connector")];
|
|
||||||
[assembly:AssemblyCopyrightAttribute("Copyright (c) 2013")];
|
|
||||||
[assembly:AssemblyTrademarkAttribute("")];
|
|
||||||
[assembly:AssemblyCultureAttribute("")];
|
|
||||||
|
|
||||||
//
|
|
||||||
// Version information for an assembly consists of the following four values:
|
|
||||||
//
|
|
||||||
// Major Version
|
|
||||||
// Minor Version
|
|
||||||
// Build Number
|
|
||||||
// Revision
|
|
||||||
//
|
|
||||||
// You can specify all the value or you can default the Revision and Build Numbers
|
|
||||||
// by using the '*' as shown below:
|
|
||||||
|
|
||||||
[assembly:AssemblyVersionAttribute("1.0.*")];
|
|
||||||
|
|
||||||
[assembly:ComVisible(false)];
|
|
||||||
|
|
||||||
[assembly:CLSCompliantAttribute(true)];
|
|
||||||
+43
-239
@@ -2,51 +2,28 @@
|
|||||||
|
|
||||||
#include "Stdafx.h"
|
#include "Stdafx.h"
|
||||||
|
|
||||||
#include "MT5Connector.h"
|
#include <array>
|
||||||
#include "MT5Handler.h"
|
|
||||||
|
|
||||||
#include "Windows.h"
|
|
||||||
#include <vcclr.h>
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
#include <string>
|
||||||
|
#include <codecvt>
|
||||||
|
#include "Mt5Handler.h"
|
||||||
|
#include "MtService.h"
|
||||||
|
|
||||||
using namespace System;
|
static void convertSystemString(wchar_t* dest, const std::string& src)
|
||||||
using namespace MTApiService;
|
|
||||||
using namespace System::Runtime::InteropServices;
|
|
||||||
using namespace System::Reflection;
|
|
||||||
using namespace System::Text;
|
|
||||||
using namespace System::Collections::Generic;
|
|
||||||
using namespace System::Diagnostics;
|
|
||||||
using namespace System::Security::Cryptography;
|
|
||||||
using namespace System::Security;
|
|
||||||
|
|
||||||
#pragma pack(push, 1)
|
|
||||||
public struct CMqlRates
|
|
||||||
{
|
{
|
||||||
__int64 time; // Period start time
|
using convert_typeX = std::codecvt_utf8<wchar_t>;
|
||||||
double open; // Open price
|
std::wstring_convert<convert_typeX, wchar_t> converterX;
|
||||||
double high; // The highest price of the period
|
auto wstr = converterX.from_bytes(src);
|
||||||
double low; // The lowest price of the period
|
memcpy(dest, wstr.c_str(), wcsnlen(wstr.c_str(), 1000) * sizeof(wchar_t));
|
||||||
double close; // Close price
|
|
||||||
__int64 tick_volume; // Tick volume
|
|
||||||
int spread; // Spread
|
|
||||||
__int64 real_volume; // Trade volume
|
|
||||||
};
|
|
||||||
#pragma pack(pop)
|
|
||||||
|
|
||||||
void convertSystemString(wchar_t* dest, String^ src)
|
|
||||||
{
|
|
||||||
if (src != nullptr) {
|
|
||||||
pin_ptr<const wchar_t> wch = PtrToStringChars(src);
|
|
||||||
memcpy(dest, wch, wcsnlen(wch, 1000) * sizeof(wchar_t));
|
|
||||||
dest[wcsnlen(wch, 1000)] = L'\0';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dest[0] = L'\0';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#define _DLLAPI extern "C" __declspec(dllexport)
|
static std::string convertWString(const wchar_t* src)
|
||||||
|
{
|
||||||
|
std::wstring string_to_convert(src);
|
||||||
|
using convert_typeX = std::codecvt_utf8<wchar_t>;
|
||||||
|
std::wstring_convert<convert_typeX, wchar_t> converterX;
|
||||||
|
return converterX.to_bytes(string_to_convert);
|
||||||
|
}
|
||||||
|
|
||||||
template <typename T> T Execute(std::function<T()> func, wchar_t* err, T default_value)
|
template <typename T> T Execute(std::function<T()> func, wchar_t* err, T default_value)
|
||||||
{
|
{
|
||||||
@@ -55,233 +32,60 @@ template <typename T> T Execute(std::function<T()> func, wchar_t* err, T default
|
|||||||
{
|
{
|
||||||
result = func();
|
result = func();
|
||||||
}
|
}
|
||||||
catch (Exception^ e)
|
catch (std::exception& e)
|
||||||
{
|
{
|
||||||
convertSystemString(err, e->Message);
|
convertSystemString(err, e.what());
|
||||||
MtAdapter::GetInstance()->LogError(e->Message);
|
MtService::GetInstance().LogError(e.what());
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
_DLLAPI int _stdcall initExpert(int expertHandle, int port, wchar_t* symbol, double bid, double ask, int isTestMode, wchar_t* err)
|
int initExpert(int expertHandle, int port, int isTestMode, wchar_t* err)
|
||||||
{
|
{
|
||||||
return Execute<int>([&expertHandle, &port, symbol, &bid, &ask, &isTestMode]() {
|
return Execute<int>([&expertHandle, &port, &isTestMode]() {
|
||||||
bool isTesting = (isTestMode != 0) ? true : false;
|
bool isTesting = (isTestMode != 0) ? true : false;
|
||||||
auto expert = gcnew Mt5Expert(expertHandle, gcnew String(symbol), bid, ask, gcnew MT5Handler(), isTesting);
|
auto mt_handler = std::make_unique<MT5Handler>(expertHandle);
|
||||||
MtAdapter::GetInstance()->AddExpert(port, expert);
|
MtService::GetInstance().InitExpert(port, expertHandle, std::move(mt_handler));
|
||||||
return 1;
|
return 1;
|
||||||
}, err, 0);
|
}, err, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
_DLLAPI int _stdcall deinitExpert(int expertHandle, wchar_t* err)
|
int deinitExpert(int expertHandle, wchar_t* err)
|
||||||
{
|
{
|
||||||
return Execute<int>([&expertHandle]() {
|
return Execute<int>([&expertHandle]() {
|
||||||
MtAdapter::GetInstance()->RemoveExpert(expertHandle);
|
MtService::GetInstance().DeinitExpert(expertHandle);
|
||||||
return 1;
|
return 1;
|
||||||
}, err, 0);
|
}, err, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
_DLLAPI int _stdcall updateQuote(int expertHandle, wchar_t* symbol, double bid, double ask, wchar_t* err)
|
bool sendEvent(int expertHandle, int event_type, const wchar_t* payload, wchar_t* err)
|
||||||
{
|
{
|
||||||
return Execute<int>([&expertHandle, symbol, &bid, &ask]() {
|
return Execute<bool>([&expertHandle, &event_type, payload]() {
|
||||||
MtAdapter::GetInstance()->SendQuote(expertHandle, gcnew String(symbol), bid, ask);
|
MtService::GetInstance().SendEvent(expertHandle, event_type, convertWString(payload));
|
||||||
return 1;
|
|
||||||
}, err, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
_DLLAPI bool _stdcall sendEvent(int expertHandle, int eventType, wchar_t* payload, wchar_t* err)
|
|
||||||
{
|
|
||||||
return Execute<bool>([&expertHandle, &eventType, payload]() {
|
|
||||||
MtAdapter::GetInstance()->SendEvent(expertHandle, eventType, gcnew String(payload));
|
|
||||||
return true;
|
return true;
|
||||||
}, err, false);
|
}, err, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
_DLLAPI int _stdcall sendIntResponse(int expertHandle, int response, wchar_t* err)
|
int sendResponse(int expertHandle, const wchar_t* response, wchar_t* err)
|
||||||
{
|
|
||||||
return Execute<int>([&expertHandle, &response]() {
|
|
||||||
MtAdapter::GetInstance()->SendResponse(expertHandle, gcnew MtResponseInt(response));
|
|
||||||
return 1;
|
|
||||||
}, err, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
_DLLAPI int _stdcall sendLongResponse(int expertHandle, __int64 response, wchar_t* err)
|
|
||||||
{
|
|
||||||
return Execute<int>([&expertHandle, &response]() {
|
|
||||||
MtAdapter::GetInstance()->SendResponse(expertHandle, gcnew MtResponseLong(response));
|
|
||||||
return 1;
|
|
||||||
}, err, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
_DLLAPI int _stdcall sendULongResponse(int expertHandle, unsigned __int64 response, wchar_t* err)
|
|
||||||
{
|
|
||||||
return Execute<int>([&expertHandle, &response]() {
|
|
||||||
MtAdapter::GetInstance()->SendResponse(expertHandle, gcnew MtResponseULong(response));
|
|
||||||
return 1;
|
|
||||||
}, err, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
_DLLAPI int _stdcall sendBooleanResponse(int expertHandle, int response, wchar_t* err)
|
|
||||||
{
|
|
||||||
return Execute<int>([&expertHandle, &response]() {
|
|
||||||
bool value = (response != 0) ? true : false;
|
|
||||||
MtAdapter::GetInstance()->SendResponse(expertHandle, gcnew MtResponseBool(value));
|
|
||||||
return 1;
|
|
||||||
}, err, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
_DLLAPI int _stdcall sendDoubleResponse(int expertHandle, double response, wchar_t* err)
|
|
||||||
{
|
|
||||||
return Execute<int>([&expertHandle, &response]() {
|
|
||||||
MtAdapter::GetInstance()->SendResponse(expertHandle, gcnew MtResponseDouble(response));
|
|
||||||
return 1;
|
|
||||||
}, err, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
_DLLAPI int _stdcall sendStringResponse(int expertHandle, wchar_t* response, wchar_t* err)
|
|
||||||
{
|
{
|
||||||
return Execute<int>([&expertHandle, response]() {
|
return Execute<int>([&expertHandle, response]() {
|
||||||
MtAdapter::GetInstance()->SendResponse(expertHandle, gcnew MtResponseString(gcnew String(response)));
|
MtService::GetInstance().SendResponse(expertHandle, convertWString(response));
|
||||||
return 1;
|
return 1;
|
||||||
}, err, 0);
|
}, err, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
_DLLAPI int _stdcall sendVoidResponse(int expertHandle, wchar_t* err)
|
int getCommandType(int expertHandle, int& res, wchar_t* err)
|
||||||
{
|
|
||||||
return Execute<int>([&expertHandle]() {
|
|
||||||
MtAdapter::GetInstance()->SendResponse(expertHandle, gcnew MtResponseObject(nullptr));
|
|
||||||
return 1;
|
|
||||||
}, err, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
_DLLAPI int _stdcall sendDoubleArrayResponse(int expertHandle, double* values, int size, wchar_t* err)
|
|
||||||
{
|
|
||||||
return Execute<int>([&expertHandle, values, &size]() {
|
|
||||||
array<double>^ list = gcnew array<double>(size);
|
|
||||||
for (int i = 0; i < size; i++)
|
|
||||||
list[i] = values[i];
|
|
||||||
MtAdapter::GetInstance()->SendResponse(expertHandle, gcnew MtResponseDoubleArray(list));
|
|
||||||
return 1;
|
|
||||||
}, err, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
_DLLAPI int _stdcall sendIntArrayResponse(int expertHandle, int* values, int size, wchar_t* err)
|
|
||||||
{
|
|
||||||
return Execute<int>([&expertHandle, values, &size]() {
|
|
||||||
array<int>^ list = gcnew array<int>(size);
|
|
||||||
for (int i = 0; i < size; i++)
|
|
||||||
list[i] = values[i];
|
|
||||||
MtAdapter::GetInstance()->SendResponse(expertHandle, gcnew MtResponseIntArray(list));
|
|
||||||
return 1;
|
|
||||||
}, err, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
_DLLAPI int _stdcall sendLongArrayResponse(int expertHandle, __int64* values, int size, wchar_t* err)
|
|
||||||
{
|
|
||||||
return Execute<int>([&expertHandle, values, &size]() {
|
|
||||||
array<System::Int64>^ list = gcnew array<System::Int64>(size);
|
|
||||||
for (int i = 0; i < size; i++)
|
|
||||||
list[i] = values[i];
|
|
||||||
MtAdapter::GetInstance()->SendResponse(expertHandle, gcnew MtResponseLongArray(list));
|
|
||||||
return 1;
|
|
||||||
}, err, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
_DLLAPI int _stdcall sendMqlRatesArrayResponse(int expertHandle, CMqlRates values[], int size, wchar_t* err)
|
|
||||||
{
|
|
||||||
return Execute<int>([&expertHandle, values, &size]() {
|
|
||||||
array<MtMqlRates^>^ list = gcnew array<MtMqlRates^>(size);
|
|
||||||
for (int i = 0; i < size; i++)
|
|
||||||
{
|
|
||||||
MtMqlRates^ rates = gcnew MtMqlRates();
|
|
||||||
rates->time = values[i].time;
|
|
||||||
rates->open = values[i].open;
|
|
||||||
rates->high = values[i].high;
|
|
||||||
rates->low = values[i].low;
|
|
||||||
rates->close = values[i].close;
|
|
||||||
rates->tick_volume = values[i].tick_volume;
|
|
||||||
rates->spread = values[i].spread;
|
|
||||||
rates->real_volume = values[i].real_volume;
|
|
||||||
list[i] = rates;
|
|
||||||
}
|
|
||||||
MtAdapter::GetInstance()->SendResponse(expertHandle, gcnew MtResponseMqlRatesArray(list));
|
|
||||||
return 1;
|
|
||||||
}, err, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
_DLLAPI int _stdcall sendErrorResponse(int expertHandle, int code, wchar_t* message, wchar_t* err)
|
|
||||||
{
|
|
||||||
return Execute<int>([&expertHandle, &code, message]() {
|
|
||||||
MtResponseString^ res = gcnew MtResponseString(gcnew String(message));
|
|
||||||
res->ErrorCode = code;
|
|
||||||
MtAdapter::GetInstance()->SendResponse(expertHandle, res);
|
|
||||||
return true;
|
|
||||||
}, err, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------- get values -------------------------------
|
|
||||||
|
|
||||||
_DLLAPI int _stdcall getCommandType(int expertHandle, int& res, wchar_t* err)
|
|
||||||
{
|
{
|
||||||
return Execute<int>([&expertHandle, &res]() {
|
return Execute<int>([&expertHandle, &res]() {
|
||||||
res = MtAdapter::GetInstance()->GetCommandType(expertHandle);
|
res = MtService::GetInstance().GetCommandType(expertHandle);
|
||||||
return 1;
|
return 1;
|
||||||
}, err, 0);
|
}, err, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
_DLLAPI int _stdcall getIntValue(int expertHandle, int paramIndex, int& res, wchar_t* err)
|
int getPayload(int expertHandle, wchar_t* res, wchar_t* err)
|
||||||
{
|
{
|
||||||
return Execute<int>([&expertHandle, ¶mIndex, &res]() {
|
return Execute<int>([&expertHandle, res]() {
|
||||||
res = MtAdapter::GetInstance()->GetCommandParameter<int>(expertHandle, paramIndex);
|
convertSystemString(res, MtService::GetInstance().GetCommandPayload(expertHandle));
|
||||||
return 1;
|
return 1;
|
||||||
}, err, 0);
|
}, err, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
_DLLAPI int _stdcall getDoubleValue(int expertHandle, int paramIndex, double& res, wchar_t* err)
|
|
||||||
{
|
|
||||||
return Execute<int>([&expertHandle, ¶mIndex, &res]() {
|
|
||||||
res = MtAdapter::GetInstance()->GetCommandParameter<double>(expertHandle, paramIndex);
|
|
||||||
return 1;
|
|
||||||
}, err, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
_DLLAPI int _stdcall getStringValue(int expertHandle, int paramIndex, wchar_t* res, wchar_t* err)
|
|
||||||
{
|
|
||||||
return Execute<int>([&expertHandle, ¶mIndex, res]() {
|
|
||||||
convertSystemString(res, MtAdapter::GetInstance()->GetCommandParameter<String^>(expertHandle, paramIndex));
|
|
||||||
return 1;
|
|
||||||
}, err, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
_DLLAPI int _stdcall getULongValue(int expertHandle, int paramIndex, unsigned __int64& res, wchar_t* err)
|
|
||||||
{
|
|
||||||
return Execute<int>([&expertHandle, ¶mIndex, &res]() {
|
|
||||||
res = MtAdapter::GetInstance()->GetCommandParameter<unsigned __int64>(expertHandle, paramIndex);
|
|
||||||
return 1;
|
|
||||||
}, err, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
_DLLAPI int _stdcall getLongValue(int expertHandle, int paramIndex, __int64& res, wchar_t* err)
|
|
||||||
{
|
|
||||||
return Execute<int>([&expertHandle, ¶mIndex, &res]() {
|
|
||||||
res = MtAdapter::GetInstance()->GetCommandParameter<__int64>(expertHandle, paramIndex);
|
|
||||||
return 1;
|
|
||||||
}, err, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
_DLLAPI int _stdcall getBooleanValue(int expertHandle, int paramIndex, int& res, wchar_t* err)
|
|
||||||
{
|
|
||||||
return Execute<int>([&expertHandle, ¶mIndex, &res]() {
|
|
||||||
bool val = MtAdapter::GetInstance()->GetCommandParameter<bool>(expertHandle, paramIndex);
|
|
||||||
res = val == true ? 1 : 0;
|
|
||||||
return 1;
|
|
||||||
}, err, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
_DLLAPI int _stdcall getUIntValue(int expertHandle, int paramIndex, unsigned int& res, wchar_t* err)
|
|
||||||
{
|
|
||||||
return Execute<int>([&expertHandle, ¶mIndex, &res]() {
|
|
||||||
res = MtAdapter::GetInstance()->GetCommandParameter<unsigned int>(expertHandle, paramIndex);
|
|
||||||
return 1;
|
|
||||||
}, err, 0);
|
|
||||||
}
|
|
||||||
@@ -20,10 +20,9 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<PropertyGroup Label="Globals">
|
<PropertyGroup Label="Globals">
|
||||||
<ProjectGuid>{CB6D4A3E-2F2E-4C67-929D-3C2A8FD1C556}</ProjectGuid>
|
<ProjectGuid>{CB6D4A3E-2F2E-4C67-929D-3C2A8FD1C556}</ProjectGuid>
|
||||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
|
||||||
<Keyword>ManagedCProj</Keyword>
|
<Keyword>ManagedCProj</Keyword>
|
||||||
<RootNamespace>MT5Connector</RootNamespace>
|
<RootNamespace>MT5Connector</RootNamespace>
|
||||||
<WindowsTargetPlatformVersion>10.0.17134.0</WindowsTargetPlatformVersion>
|
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
@@ -36,9 +35,8 @@
|
|||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
<CLRSupport>true</CLRSupport>
|
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
<PlatformToolset>v141</PlatformToolset>
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
@@ -77,6 +75,7 @@
|
|||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
<LinkIncremental>true</LinkIncremental>
|
<LinkIncremental>true</LinkIncremental>
|
||||||
<OutDir>$(SolutionDir)build\products\$(Configuration)\$(Platform)\</OutDir>
|
<OutDir>$(SolutionDir)build\products\$(Configuration)\$(Platform)\</OutDir>
|
||||||
|
<LibraryPath>$(SolutionDir)thirdparty\libs;$(LibraryPath)</LibraryPath>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
<LinkIncremental>false</LinkIncremental>
|
<LinkIncremental>false</LinkIncremental>
|
||||||
@@ -104,10 +103,10 @@
|
|||||||
<Optimization>Disabled</Optimization>
|
<Optimization>Disabled</Optimization>
|
||||||
<PreprocessorDefinitions>WIN32;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WIN32;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||||
|
<AdditionalIncludeDirectories>$(SolutionDir)MtService;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
<AdditionalDependencies>user32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
@@ -143,7 +142,6 @@
|
|||||||
<ClInclude Include="Stdafx.h" />
|
<ClInclude Include="Stdafx.h" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="AssemblyInfo.cpp" />
|
|
||||||
<ClCompile Include="MT5Connector.cpp" />
|
<ClCompile Include="MT5Connector.cpp" />
|
||||||
<ClCompile Include="Stdafx.cpp">
|
<ClCompile Include="Stdafx.cpp">
|
||||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
||||||
@@ -154,7 +152,6 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="app.ico" />
|
<None Include="app.ico" />
|
||||||
<None Include="ReadMe.txt" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ResourceCompile Include="app.rc" />
|
<ResourceCompile Include="app.rc" />
|
||||||
@@ -171,6 +168,9 @@
|
|||||||
<LinkLibraryDependencies>true</LinkLibraryDependencies>
|
<LinkLibraryDependencies>true</LinkLibraryDependencies>
|
||||||
<UseLibraryDependencyInputs>false</UseLibraryDependencyInputs>
|
<UseLibraryDependencyInputs>false</UseLibraryDependencyInputs>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\MtService\MtService.vcxproj">
|
||||||
|
<Project>{3effff03-2a1d-48aa-a49a-9f90889f31e0}</Project>
|
||||||
|
</ProjectReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
<ImportGroup Label="ExtensionTargets">
|
<ImportGroup Label="ExtensionTargets">
|
||||||
|
|||||||
@@ -3,22 +3,25 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
|
#include <MetaTraderHandler.h>
|
||||||
|
|
||||||
using namespace MTApiService;
|
class MT5Handler: public MetaTraderHandler
|
||||||
|
|
||||||
ref class MT5Handler: IMetaTraderHandler
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MT5Handler()
|
MT5Handler(int handle)
|
||||||
|
: handle_(handle)
|
||||||
{
|
{
|
||||||
msgId = WM_TIMER;
|
msgId = WM_TIMER;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void SendTickToMetaTrader(int handle)
|
~MT5Handler() override = default;
|
||||||
{
|
|
||||||
PostMessage((HWND)handle, msgId, 0, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void SendTickToMetaTrader() override
|
||||||
|
{
|
||||||
|
PostMessage((HWND)handle_, msgId, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
int handle_;
|
||||||
unsigned int msgId;
|
unsigned int msgId;
|
||||||
};
|
};
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
========================================================================
|
|
||||||
DYNAMIC LINK LIBRARY : MT5Connector Project Overview
|
|
||||||
========================================================================
|
|
||||||
|
|
||||||
AppWizard has created this MT5Connector DLL for you.
|
|
||||||
|
|
||||||
This file contains a summary of what you will find in each of the files that
|
|
||||||
make up your MT5Connector application.
|
|
||||||
|
|
||||||
MT5Connector.vcxproj
|
|
||||||
This is the main project file for VC++ projects generated using an Application Wizard.
|
|
||||||
It contains information about the version of Visual C++ that generated the file, and
|
|
||||||
information about the platforms, configurations, and project features selected with the
|
|
||||||
Application Wizard.
|
|
||||||
|
|
||||||
MT5Connector.vcxproj.filters
|
|
||||||
This is the filters file for VC++ projects generated using an Application Wizard.
|
|
||||||
It contains information about the association between the files in your project
|
|
||||||
and the filters. This association is used in the IDE to show grouping of files with
|
|
||||||
similar extensions under a specific node (for e.g. ".cpp" files are associated with the
|
|
||||||
"Source Files" filter).
|
|
||||||
|
|
||||||
MT5Connector.cpp
|
|
||||||
This is the main DLL source file.
|
|
||||||
|
|
||||||
MT5Connector.h
|
|
||||||
This file contains a class declaration.
|
|
||||||
|
|
||||||
AssemblyInfo.cpp
|
|
||||||
Contains custom attributes for modifying assembly metadata.
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
|
||||||
Other notes:
|
|
||||||
|
|
||||||
AppWizard uses "TODO:" to indicate parts of the source code you
|
|
||||||
should add to or customize.
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
|
||||||
@@ -7,6 +7,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MtClient", "MtClient\MtClie
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MtService", "MtService\MtService.vcxproj", "{3EFFFF03-2A1D-48AA-A49A-9F90889F31E0}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MtService", "MtService\MtService.vcxproj", "{3EFFFF03-2A1D-48AA-A49A-9F90889F31E0}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MT5Connector", "MT5Connector\MT5Connector.vcxproj", "{CB6D4A3E-2F2E-4C67-929D-3C2A8FD1C556}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
@@ -41,6 +43,18 @@ Global
|
|||||||
{3EFFFF03-2A1D-48AA-A49A-9F90889F31E0}.Release|x64.Build.0 = Release|x64
|
{3EFFFF03-2A1D-48AA-A49A-9F90889F31E0}.Release|x64.Build.0 = Release|x64
|
||||||
{3EFFFF03-2A1D-48AA-A49A-9F90889F31E0}.Release|x86.ActiveCfg = Release|Win32
|
{3EFFFF03-2A1D-48AA-A49A-9F90889F31E0}.Release|x86.ActiveCfg = Release|Win32
|
||||||
{3EFFFF03-2A1D-48AA-A49A-9F90889F31E0}.Release|x86.Build.0 = Release|Win32
|
{3EFFFF03-2A1D-48AA-A49A-9F90889F31E0}.Release|x86.Build.0 = Release|Win32
|
||||||
|
{CB6D4A3E-2F2E-4C67-929D-3C2A8FD1C556}.Debug|Any CPU.ActiveCfg = Debug|x64
|
||||||
|
{CB6D4A3E-2F2E-4C67-929D-3C2A8FD1C556}.Debug|Any CPU.Build.0 = Debug|x64
|
||||||
|
{CB6D4A3E-2F2E-4C67-929D-3C2A8FD1C556}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
|
{CB6D4A3E-2F2E-4C67-929D-3C2A8FD1C556}.Debug|x64.Build.0 = Debug|x64
|
||||||
|
{CB6D4A3E-2F2E-4C67-929D-3C2A8FD1C556}.Debug|x86.ActiveCfg = Debug|Win32
|
||||||
|
{CB6D4A3E-2F2E-4C67-929D-3C2A8FD1C556}.Debug|x86.Build.0 = Debug|Win32
|
||||||
|
{CB6D4A3E-2F2E-4C67-929D-3C2A8FD1C556}.Release|Any CPU.ActiveCfg = Release|x64
|
||||||
|
{CB6D4A3E-2F2E-4C67-929D-3C2A8FD1C556}.Release|Any CPU.Build.0 = Release|x64
|
||||||
|
{CB6D4A3E-2F2E-4C67-929D-3C2A8FD1C556}.Release|x64.ActiveCfg = Release|x64
|
||||||
|
{CB6D4A3E-2F2E-4C67-929D-3C2A8FD1C556}.Release|x64.Build.0 = Release|x64
|
||||||
|
{CB6D4A3E-2F2E-4C67-929D-3C2A8FD1C556}.Release|x86.ActiveCfg = Release|Win32
|
||||||
|
{CB6D4A3E-2F2E-4C67-929D-3C2A8FD1C556}.Release|x86.Build.0 = Release|Win32
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|||||||
@@ -112,8 +112,7 @@
|
|||||||
<ConformanceMode>true</ConformanceMode>
|
<ConformanceMode>true</ConformanceMode>
|
||||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||||
<AdditionalIncludeDirectories>C:\Users\vdemy\source\repos\MtService\MtService;C:\Users\vdemy\source\repos\MtService\thirdparty\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(SolutionDir)thirdparty\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<LanguageStandard>Default</LanguageStandard>
|
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>
|
<SubSystem>
|
||||||
|
|||||||
Reference in New Issue
Block a user