ShellExecuteW(...)在MetaTrader 4中是否只能运行一次? [英] Does ShellExecuteW(...) work only once in MetaTrader 4 or not?

查看:214
本文介绍了ShellExecuteW(...)在MetaTrader 4中是否只能运行一次?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试使用 ShellExecuteW() MQL4启动 .exe .

此命令是否只能运行一次?

#import "shell32.dll"   // MQL4-syntax-wrapper-Bo[#import]Container
                        // v-------------- caller-side interface to DLL
        int ShellExecuteW( int    hWnd,
                           int    lpVerb,
                           string lpFile,
                           int    lpParameters,
                           int    lpDirectory,
                           int    nCmdShow
                           );
#import                 // MQL4-syntax-wrapper-Eo[#import]Container

if (  cond == true ){
      ShellExecuteW( 0, "open", "D:\\Execute.exe", "", "", 1 );
   }

推荐答案

A:简短版本

也许是,也许不是.

A: a short version

Maybe yes, maybe no.

事实: MT4终端的过程控制/过程管理没有什么优越之处,但是,它允许您集成多条控制线,以对MT4终端内部(和外部...不仅通过ShellExecuteW(...) ...)发生的事情进行控制.

Fact: MT4 Terminal's process-control / process-management is nothing superior, however it allows you to integrate several lines of control over what happens inside ( and outside ... not only via ShellExecuteW(...) ... ) the MT4 Terminal.

MT4终端每图形支持以下过程(通过内置线程):

MT4 Terminal supports the following processes per graph ( via built-in threads ):

  1. { 0 | 1 }出现名为MQL4- ExpertAdvisor
  2. 的单例实例
  3. { 0 | 1 }出现称为MQL4- 脚本
  4. 的单例实例
  5. { 0 | 1 ... n }出现功能受限的实例MQL4- TechnicalIndicator
  1. { 0 | 1 } occurences of a singleton instance called MQL4-ExpertAdvisor
  2. { 0 | 1 } occurences of a singleton instance called MQL4-Script
  3. { 0 | 1 ... n } occurences of a functionally restricted instance called MQL4-TechnicalIndicator

这些实例的性质在几个方面有所不同,但是在与您的问题最接近的关系中,每个过程都具有一个强制部分和一组任意部分.

The nature of these instances differs in several ways, however in the closest relation to your question, each of the processes have both a mandatory part and a set of arbitrary parts.

用原始的 MQL4 讲(可能已经注意到,自Build 7xx MQL4语言语法向MQL5越来越近,因此有时被标记为MQL4.5:o))

Speaking in the original MQL4 ( one may have noticed, that since Build 7xx MQL4 language syntax has moved closer and closer towards MQL5, thus sometimes got labeled as MQL4.5 :o) )

//\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
//
// MQL4 code ----------------------------------------------------------<BoF>------

// MQL4 code compiler directives' section -----------------------<BoS>

#import ...                // MQL4-syntax-wrapper-Bo[#import]Container
        ..
        .
#import                    // MQL4-syntax-wrapper-Eo[#import]Container

// MQL4 code compiler directives' section -----------------------<EoS>

// ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
//
// MQL4 code section ---------------------------- init() / start() / deinit()
//

int init(){    // this part is being run just once,
               //                        right upon an instance activation
   }

int start(){   // this part is being run just once, for an MQL4-Script
               //                        right upon an instance activation
               //                    run upon an FX-MarketEvent is being observed
               //                             in an MQL4-ExpertAdvisor
               //                             or
               //                             in an MQL4-TechnicalIndicator


   }
...
..
.
//
// MQL4 code ---------------------------------------------------------<EoF>------
//
//\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/

因此,部署代码的确切位置(重新使用)通用DLL服务(#import -ed用于编译时对齐和动态链接(重新使用))决定了多少要求外部流程被调用的时间.

So, the exact location of your deployment code, that (re-)uses the generic DLL-service ( #import-ed for both the compile-time alignment and the dynamic linking upon (re-use) decides how many times the external process has been asked to get invoked.

将MT4终端与外部流程或远程流程(云与网格")集成在一起的方法要比基于DLL的另一盲人& amp;生成的方法更加聪明.充耳不闻的<localhost>流程.

There are much smarter ways to integrate MT4 Terminal with external processes or remote processes ( Clouds & Grids ) than just a DLL-based spawn of just another blind & deaf unmanageable <localhost> process.

通常情况下,既需要流程控制又需要流程之间的双向通信.

Typically one needs both process-control and bidirectional communication between / among processes.

不要犹豫,问更多.

MT4(带有一些其他工具)可以做到.

MT4 ( with some additional tools ) can do.

这篇关于ShellExecuteW(...)在MetaTrader 4中是否只能运行一次?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆