调用system()时如何隐藏控制台窗口? [英] How to hide console windows when calling system()?

查看:132
本文介绍了调用system()时如何隐藏控制台窗口?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前我正在使用系统("\" C:\ Program Files \ Common Files \ microsoft共享\ ink \ TabTip.exe \");打开虚拟键盘和系统("TASKKILL/IM TabTip.exe/F");杀死它

currently im using system("\"C:\Program Files\Common Files\microsoft shared\ink\TabTip.exe\""); to open up the virtual keyboard and system("TASKKILL /IM TabTip.exe /F"); to kill it

它似乎正常工作,但始终会弹出一个控制台窗口我该如何摆脱呢?谢谢!

its seems working but there is always a console window poping up how can i get rid of that? thanks!

推荐答案

在主程序的开头添加以下代码,然后使用popen api创建"TabTip.exe".由于您的应用程序中现在有一个隐藏的控制台,因此将不会显示由popen创建的TabTip.exe.

Add below code in the beginning of your main, then create "TabTip.exe" with popen api. Because there is a hidden console in your app now, TabTip.exe created by the popen won't be shown.

AllocConsole();
ShowWindow(GetConsoleWindow(), SW_HIDE);

这篇关于调用system()时如何隐藏控制台窗口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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