Skype 제어 라이브러리 – MetaTrader용 라이브러리 4

0
(0)

In the automatic trading Skype can be used for sending text messages with the necessary information. 이 경우 Skype 작업은 라이브러리 Skype4COM을 통해 실현됩니다., 즉. 프로그램 관리에 대한 액세스를 나타내는 ActiveX 구성 요소. 개발자의 공식 웹 사이트에서 Skype4COM을 다운로드할 수 있습니다.: http://dev.skype.com/accessories/skype4com

Skype4COM.dll file must be installed and registered.

For an operating system x86:

  • Copy to the %systemroot%\System32 folder;
  • Run in the command line: %systemroot%\System32\regsvr32.exe %systemroot%\System32\Skype4COM.dll.

For an operating system x64:

  • Copy to the %systemroot%\SysWOW64 folder;
  • Run in the command line: %systemroot%\SysWOW64\regsvr32.exe %systemroot%\SysWOW64\Skype4COM.dll.

This SkypeMQL.dll library file must be installed in the folder: [terminal directory]\MQL5\Libraries

 

1. Sending instant messages

int SkypeSendInstantMessageW(string skype_name,string message,int status);
int SkypeSendInstantMessageA(string skype_name,string message,int status);// 메타트레이더용 4

There are several tests in a function before sending instant message:

  • The user name cannot be empty or begin with a number.
  • The user with the specified name must be in the contact list.
  • The message cannot be an empty string.
  • The network status of the recipient must coincide with the specified value.

The list of the network status constants:

constant name description
STATUS_OFFLINE 1 Skype Control Library - library for MetaTrader 4 2
Skype Control Library - library for MetaTrader 4 3 Offline
STATUS_ONLINE 2 Skype Control Library - library for MetaTrader 4 4 Online
STATUS_AWAY 4 Skype Control Library - library for MetaTrader 4 5 Out of place
STATUS_DONT_DISTURB 16 Skype Control Library - library for MetaTrader 4 6 Do not disturb

To set several allowed statuses simultaneously bit-by-bit addition of constants is used, 예를 들어: STATUS_ONLINE | STATUS_AWAY.

The maximum length of an instant message is ~8000 ANSI symbols, ~4000 Unicode symbols.

The example of a code:

string InpSkypeName     =  "echo123";        // Skype name
string InpTextMessage   =  "안녕하세요 :)";       // Text message

string msg;
ENUM_SKYPE_ERROR err=(ENUM_SKYPE_ERROR)SkypeSendInstantMessageW(InpSkypeName,InpTextMessage,STATUS_ONLINE|STATUS_AWAY);

만약에(err==ERROR_NO_ERRORS) msg=StringFormat("Sent IM to %s, %에스",InpSkypeName,InpTextMessage);
또 다른 msg=StringFormat("Error sending IM to %s, 오류: %에스",InpSkypeName,EnumToString(err));

Print(msg);

2. Sending SMS messages

The service to send SMS messages is fee-paid at the moment!

int SkypeSendSmsMessageW(string phone_number, string message);
int SkypeSendSmsMessageA(string phone_number, string message);// для MetaTrader 4

There are several tests before sending SMS message:

  • The telephone number must be specified in the international format: + [country code] [city or network code] [telephone number]
  • The length of the string which contains the telephone number must be at least 7 symbols and start with a '+' sign
  • Text message must not be an empty string

Sending SMS to a non existing number is not an error. The cost for this operation will be charged, but returned after a short time, as the actual message wasn't delivered.

The SMS message is limited to 116 ANSI symbols, 58 Unicode symbols.

The example of a code:

input string InpPhoneNumber   =  "+380123456789";  // Phone number
input string InpTextMessage   =  "안녕하세요 :)";       // Text message

string msg;
ENUM_SKYPE_ERROR err==(ENUM_SKYPE_ERROR) SkypeSendSmsMessageW(InpPhoneNumber,InpTextMessage);

만약에(err==ERROR_NO_ERRORS) msg=StringFormat("Sent SMS to %s, %에스",InpPhoneNumber,InpTextMessage);
또 다른 msg=StringFormat("Error sending SMS to %s, 오류: %에스",InpPhoneNumber,EnumToString(err));

Print(msg);

3. Description of the return values

Both functions return an integer value which can be analyzed, 필요하다면.

constant name description
ERROR_UNKNOWN -1 Unknown error
ERROR_NO_ERRORS 0 Successful execution
ERROR_ATTACH 1 Failed to connect to Skype
ERROR_AUTHORIZED 2 There is no specified user in the contact list
ERROR_STATUS 3 Invalid user status
ERROR_TIMEOUTS 4 Timed out
ERROR_RUNNING 5 Skype is not loaded to memory
ERROR_SENDING 6 Sending error
ERROR_VALUE 7 Transferred parameters error
ERROR_ACCESS 8 Access to Skype is denied
ERROR_SKYPE4COM 9 for x86: Skype4COM.dll is not registered
for x64: COM-object creation error

4. The first launch

At first connection MetaTrader 5 to Skype a pop up window appears which enables program management access.

Skype Control Library - library for MetaTrader 4 7

After conforming access to Skype, the requesting process enters to the list stored in the program settings: 도구 -> 옵션 -> Advanced -> Manage other programs' access to Skype.

Skype Control Library - library for MetaTrader 4 8

 

5. Runtime errors

By unknown reasons, the work with the library compiled for MetaTrader 5 x64 ends with "Stack overflow" 오류. If it is connected with Skype4COM, then you have to wait for the new messages where this error will be corrected.

The attachment has an archive with library source code (a project for Microsoft Visual C++ 2010) and test script to check its performance.

이 게시물이 얼마나 유용했나요??

평가하려면 별표를 클릭하세요.!

평균 평점 0 / 5. 투표수: 0

현재까지 투표가 없습니다! 이 게시물을 가장 먼저 평가해 보세요..

이 게시물이 귀하에게 도움이 되지 못했다니 죄송합니다!

이 게시물을 개선해 보겠습니다.!

이 게시물을 개선할 수 있는 방법을 알려주세요.?



작가: 외환 위키 팀
우리는 경험이 풍부한 Forex 트레이더 팀입니다. [2000-2023] 우리 자신의 조건에 따라 삶을 살기 위해 헌신하는 사람들. 우리의 주요 목표는 재정적 독립과 자유를 얻는 것입니다., 우리는 자기 교육을 추구하고 Forex 시장에서 자립 가능한 라이프 스타일을 달성하기 위한 수단으로 광범위한 경험을 얻었습니다..