如何使用MQL4脚本打开指标Indicators目录,MQL4使用ShellExecute打开文件夹?
今天有个兄弟问我,如何使用MQL4脚本打开指标Indicators目录,MQL4使用ShellExecute打开文件夹?
直接上代码:
#property copyright "策汇在线"
#property link "https://www.fxchs.com"
#property version "1.00"
#property strict
#import "shell32.dll"
int ShellExecuteW(int hwnd,string operation,string file,string parameters,string directory,int ShowCmd);
#import
//+------------------------------------------------------------------+
//| 执行脚本打开指标目录 |
//+------------------------------------------------------------------+
void OnStart()
{
//---
// 获取数据目录路径
string datapath = TerminalInfoString(TERMINAL_DATA_PATH);
// 指定指标路径
string indpath = datapath +"\\MQL4\\Indicators";
// 打开并选择目录
ShellExecuteW(WindowHandle(NULL,0),"open","explorer", "/select," + indpath,NULL,5);
}
//+------------------------------------------------------------------+