Skype Control Library – ไลบรารี่สำหรับ MetaTrader 4

0
(0)

In the automatic trading Skype can be used for sending text messages with the necessary information. In this case work with Skype is realized via library Skype4COM, เช่น. an ActiveX component that represents access to program management. You can download Skype4COM from the official website of developers: 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

ภายใน SkypeSendInstantMessageW(สตริง skype_name,สตริง message,ภายใน status);
ภายใน SkypeSendInstantMessageA(สตริง skype_name,สตริง message,ภายใน status);// สำหรับ MetaTrader 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 ออนไลน์
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:

สตริง InpSkypeName     =  "echo123";        // Skype name
สตริง InpTextMessage   =  "สวัสดี :)";       // ข้อความ

สตริง msg;
ENUM_SKYPE_ERROR err=(ENUM_SKYPE_ERROR)SkypeSendInstantMessageW(InpSkypeName,InpTextMessage,STATUS_ONLINE|STATUS_AWAY);

ถ้า(err==ERROR_NO_ERRORS) msg=รูปแบบสตริง("Sent IM to %s, %ส",InpSkypeName,InpTextMessage);
else msg=รูปแบบสตริง("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!

ภายใน SkypeSendSmsMessageW(สตริง phone_number, สตริง message);
ภายใน SkypeSendSmsMessageA(สตริง phone_number, สตริง 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:

ป้อนข้อมูล สตริง InpPhoneNumber   =  "+380123456789";  // Phone number
ป้อนข้อมูล สตริง InpTextMessage   =  "สวัสดี :)";       // ข้อความ

สตริง msg;
ENUM_SKYPE_ERROR err==(ENUM_SKYPE_ERROR) SkypeSendSmsMessageW(InpPhoneNumber,InpTextMessage);

ถ้า(err==ERROR_NO_ERRORS) msg=รูปแบบสตริง("Sent SMS to %s, %ส",InpPhoneNumber,InpTextMessage);
else msg=รูปแบบสตริง("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 Wiki
เราคือทีมผู้ซื้อขาย Forex ที่มีประสบการณ์สูง [2000-2023] ที่อุทิศตนเพื่อใช้ชีวิตในแบบของเรา. วัตถุประสงค์หลักของเราคือการได้รับอิสรภาพทางการเงินและอิสรภาพ, และเราได้ติดตามการศึกษาด้วยตนเองและได้รับประสบการณ์ที่กว้างขวางในตลาด Forex เพื่อเป็นหนทางในการบรรลุวิถีชีวิตที่ยั่งยืนด้วยตนเอง.