在MT4或MT5中实现关闭MT进程的方法源码

在MT4或MT5中实现关闭MT进程的方法源码

//+------------------------------------------------------------------+
//|                                                    终止进程.mql4 |
//|                        Copyright 2020, MetaQuotes Software Corp. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2020, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"
#property strict

#import "kernel32.dll"
bool TerminateProcess(int handle,int code);
bool ExitProcess(int code);
#import


//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
{
//---

   // 方法一
   // TerminateProcess(-1,0);

   // 方法二
   ExitProcess(0);

}
//+------------------------------------------------------------------+