VISUAL DATAFLEX如何获得Runprogram的退出代码(VISUAL DATAFLEX How can I get the exit code of Runprogram)

编程入门 行业动态 更新时间:2024-10-28 08:29:01
VISUAL DATAFLEX如何获得Runprogram的退出代码(VISUAL DATAFLEX How can I get the exit code of Runprogram)

即时通讯启动一个DOS程序使用运行程序Runprogram wait "command plus args"这将退出1每当一个错误发生,0当一切正常工作Runprogram wait "command plus args" ...

问题是,我无法捕捉到退出代码。

我已经尝试使用ShellExecuteA但dataflex不会等待它关闭... 我也尝试过使用Chain Wait但没有任何结果。

我使用VDF 18.2我的应用程序是一个桌面应用程序。

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...

Problem is, I'm unable to catch that exit code.

I have tryed using ShellExecuteA but dataflex wont wait for it to close... I have also tryed to use Chain Wait without any possitive result.

I'm using VDF 18.2 my App is a desktop app.

最满意答案

我终于找到了像魅力一样工作的答案。 似乎是DataFlex有这个叫做strmark “魔术变量”,每次我发出Runprogram Wait ('program') ('args')命令时Runprogram Wait ('program') ('args')清理并填充这个变量。

因此,在一天结束时,我们可以做这样的事情:

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

当程序本身出现问题时,或者即使用户关闭了命令提示符窗口,这也可以起到一定的作用。

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').

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.

更多推荐

本文发布于:2023-08-06 17:41:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1453998.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:如何获得   代码   VISUAL   DATAFLEX   code

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!