首页 > 解决方案 > ShellExecute 执行后保持屏幕并等待字符

问题描述

#import "shell32.dll" 

int ShellExecuteW(int hwnd,string operation,string file,string parameters,string directory,int showCmd); 

#import
string strParameters = "/c terms.exe";

    int result = ShellExecuteW(0, "open", "cmd.exe", strParameters , NULL, 1);

    if (result <= 32) Print("Shell Execute Failed: ", result);

以上是我使用 windows 10 ShellExecute 命令在 MQL 中执行外部可执行文件的代码。但是程序中存在一个问题,我在终端上看到了这个问题,但是随着终端离开而没有让我阅读错误,我无法调试问题。请让我知道如何保持屏幕直到我按下键。这样我就可以阅读该消息。

请帮我解决一下这个。

标签: winapishellexecutemql5

解决方案


更改“cmd.exe”参数:

string strParameters = "/k terms.exe";

在命令执行后,这会使控制台窗口保持打开状态。


推荐阅读