简体   繁体   English

VISUAL DATAFLEX如何获取Runprogram的退出代码

[英]VISUAL DATAFLEX How can I get the exit code of Runprogram

Im launching a DOS program using Runprogram wait "command plus args" wich exits with 1 whenever an error happends and 0 when everything works as expected... 我使用Runprogram wait "command plus args"启动DOS程序, Runprogram wait "command plus args"并在错误发生时以1退出,而在一切正常时以0退出...

Problem is, I'm unable to catch that exit code. 问题是,我无法捕获该退出代码。

  • I have tryed using ShellExecuteA but dataflex wont wait for it to close... 我尝试使用ShellExecuteA,但是dataflex不会等待它关闭...
  • I have also tryed to use Chain Wait without any possitive result. 我也尝试过使用Chain Wait而没有任何积极的结果。

I'm using VDF 18.2 my App is a desktop app. 我正在使用VDF 18.2,我的应用程序是桌面应用程序。

I finally found the answer which is working like a charm. 我终于找到了像魅力一样有效的答案。 Seems to be that DataFlex has this "magic variable" called strmark which is cleaned and filled everytime I issue the command Runprogram Wait ('program') ('args') . 似乎是DataFlex具有称为strmark “魔术变量”,每次我发出命令Runprogram Wait ('program') ('args') ,都会清理并填充该变量。

So at the end of the day we can do something like this: 因此,在一天结束时,我们可以执行以下操作:

Runprogram Wait ('program.exe') ('my args')
If strmark Showln ('Well, we have an error my friend... Exit code: ' + strmark )
Else ...

This works like a charm when the program itself has a problem or even if the user closes the Command prompt window. 当程序本身有问题时,或者即使用户关闭了命令提示符窗口,这也一样起作用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM