Features of the mql5 language, subtleties and tricks - page 197

 
fxsaber:

This is ALT+D on the chart.

Wow... And it doesn't show in the documentation index


 

Why and how to fix it, the path needs a slash

#define    path      "/metatrader"


 
Vitaly Muzichenko:

Why and how to fix it, the path needs a slash



//
 
Vladislav Andruschenko:

//

#define    path      "//metatrader"


 
Vitaly Muzichenko:


let me try to guess ...

///

 
Vladimir Karputov:

let me try to guess ...

///

Wow!)

Thank you!

 
Vitaly Muzichenko:

Wow!)

Thank you!

What's a real 3 ///
 
Valeriy Yastremskiy:
Che really 3 ///

It did compile, but the output was 3 slashes, while the output needed only one slash. The problem was solved in another way.

 

Who can tell me how to get the hardware ID, preferably CPU or hard disk.

This code gets something, but it's not clear what

#property strict

struct SYSTEM_INFO {
   uint              dwOemId;
   uint              dwPageSize;
   long              lpMinimumApplicationAddress;
   long              lpMaximumApplicationAddress;
   ulong             dwActiveProcessorMask;
   uint              dwNumberOfProcessors;
   uint              dwProcessorType;
   uint              dwAllocationGranularity;
   ushort            wProcessorLevel;
   ushort            wProcessorRevision;
};
SYSTEM_INFO sys;
#import "kernel32.dll"
   void GetNativeSystemInfo(SYSTEM_INFO &system_info);
#import
//+------------------------------------------------------------------+
//| script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
  {
  GetNativeSystemInfo(sys);
  Print(sys.dwOemId);
  Print(sys.dwPageSize);
  Print(sys.dwActiveProcessorMask);
  Print(sys.dwNumberOfProcessors);
  Print(sys.dwProcessorType);
  Print(sys.dwAllocationGranularity);
  Print(sys.wProcessorLevel);
  Print(sys.wProcessorRevision);
//---
  }
//+------------------------------------------------------------------+

mt4

0       18:35:40.363    P EURCAD,M30: 9
0       18:35:40.363    P EURCAD,M30: 4096
0       18:35:40.363    P EURCAD,M30: 281474976719320
0       18:35:40.363    P EURCAD,M30: 705101830
0       18:35:40.363    P EURCAD,M30: 0
0       18:35:40.363    P EURCAD,M30: 0
0       18:35:40.363    P EURCAD,M30: 0
0       18:35:40.363    P EURCAD,M30: 0

mt5

FF      0       18:34:33.778    P (EURCAD,M30)  9
PR      0       18:34:33.778    P (EURCAD,M30)  4096
CO      0       18:34:33.778    P (EURCAD,M30)  15
EG      0       18:34:33.778    P (EURCAD,M30)  4
QQ      0       18:34:33.778    P (EURCAD,M30)  8664
FM      0       18:34:33.778    P (EURCAD,M30)  65536
EH      0       18:34:33.778    P (EURCAD,M30)  6
MS      0       18:34:33.778    P (EURCAD,M30)  10759

---

I couldn't find any info on the net, but I guess it's caused by another .dll

 
Vitaly Muzichenko:

Who can tell me how to get the hardware ID, preferably CPU or hard disk.

This code gets something, but it's not clear what

mt4

mt5

---

I couldn't find any info on the net, but I guess it's caused by another .dll

#ifdef __MQL5__
   #define  LPVOID long
#else
   #define  LPVOID int
#endif
#define  DWORD_PTR LPVOID

struct SYSTEM_INFO {
   uint              dwOemId;
   uint              dwPageSize;
   LPVOID            lpMinimumApplicationAddress;
   LPVOID            lpMaximumApplicationAddress;
   DWORD_PTR         dwActiveProcessorMask;
   uint              dwNumberOfProcessors;
   uint              dwProcessorType;
   uint              dwAllocationGranularity;
   ushort            wProcessorLevel;
   ushort            wProcessorRevision;
};
upd: on x86 architecture - cpuid prsessor instruction. The msvs has __cpuid(int[4],int) and __cpuidex(int[4],int,int). Examples are available online.
Reason: