易语言插入外部EXE后,肿么打开外部EXE不显示窗口?()
admin
2023-07-14 05:24:56

液晶显示器,
用写到文件的命令把那个exe程序存放到随便一个文件夹中,然后用”运行“命令来打开它,运行的参数中有个是隐藏运行的 System.Diagnostics.Process myProcess = new System.Diagnostics.Process();
myProcess.StartInfo.FileName = cmd.exe; 字符串是 文件url地址
myProcess.StartInfo.UseShellExecute = false;
myProcess.StartInfo.RedirectStandardInput = true;
myProcess.StartInfo.RedirectStandardOutput = true;
myProcess.StartInfo.RedirectStandardError = true;
myProcess.StartInfo.CreateNoWindow = true;
myProcess.Start();//启动进程 你的需求 其实就是执行一段具体的命令行
比如打开abc.exe 其实就是执行命令行的abc.exe
import java.io.BufferedReader; import java.io.InputStreamReader; public class Command { public static void exeCmd(String commandStr) { BufferedReader br = null; try { Process p = Runtime.getRuntime().exec(commandStr); br = new BufferedReader(new InputStreamReader(p.getInputStream())); String line = null; StringBuilder sb = new StringBuilder(); while ((line = br.readLine()) != null) { sb.append(line + \n); } System.out.println(sb.toString()); } catch (Exception e) { e.printStackTrace(); } finally { if (br != null) { try { br.close(); } catch (Exception e) { e.printStackTrace(); } } } } public static void main(String[] args) { String commandStr = xxx.exe; Command.exeCmd(commandStr); } } 你写的控制台吧,简单一点的办法是做一个while始终为真的循环,把所有代码套进去
还可以调用系统函数system(pause)
或者加个conio.h的头文件,用getch函数

相关内容

热门资讯

《永恒围城:无尽纪元》评测:在... 不知道还有多少人记得,在网吧里,我们守着《魔兽争霸3》的局域网创建界面,只为挤进一张名为“守卫剑阁”...