mql5语言的特点、微妙之处以及技巧 - 页 197

 
fxsaber:

这就是图表上的ALT+D。

哇......而且在文件索引中没有显示。


 

为什么以及如何解决,路径需要一个斜线

#define    path      "/metatrader"


 
Vitaly Muzichenko:

为什么以及如何解决,路径需要一个斜线



//
 
Vladislav Andruschenko:

//

#define    path      "//metatrader"


 
Vitaly Muzichenko:


让我猜一猜...

///

 
Vladimir Karputov:

让我猜一猜...

///

哇!)

谢谢你!

 
Vitaly Muzichenko:

哇!)

谢谢你!

什么是真正的3////
 
Valeriy Yastremskiy:
车真三////

它确实编译了,但输出是3个斜线,而输出只需要一个斜线。这个问题以另一种方式得到了解决。

 

谁能告诉我如何获得硬件ID,最好是CPU或硬盘。

这段代码得到了一些东西,但不清楚是什么

#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

---

我在网上找不到任何信息,但我猜这是由另一个.dll引起的。

 
Vitaly Muzichenko:

谁能告诉我如何获得硬件ID,最好是CPU或硬盘。

这段代码得到了一些东西,但不清楚是什么

mt4

mt5

---

我在网上找不到任何信息,但我认为是另一个.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;
};
更新:在X86架构上--cpuid prsessor指令。msvs中有__cpuid(int[4],int)和__cpuidex(int[4],int,int)。例子可以在网上找到。