如何防止使用AllocConsole()创建的控制台 [英] how to prevent a console created with AllocConsole()
本文介绍了如何防止使用AllocConsole()创建的控制台的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何阻止使用
创建的控制台 AllocConsole()意外关闭程序并将(或更好的托盘ico)
how to prevent a console created with AllocConsole()from the accidental closure of the program and reduce it to an icon only?(or better tray ico)
AllocConsole();
ShowWindow(GetConsoleWindow(), SW_HIDE);
BindStdHandlesToConsole();
没有办法拦截控制台消息
谢谢
Thanks
推荐答案
应该有,我知道控制台有SetConsoleCtrlHandler,它会在控制台上通知使用CTRL_CLOSE_EVENT关闭。
There should be, I know the console has SetConsoleCtrlHandler and it will notify on console close using CTRL_CLOSE_EVENT.
也许您可以使用它来使用FreeConsole从控制台分离。
Maybe you could use that to detach from the console using FreeConsole.
这篇关于如何防止使用AllocConsole()创建的控制台的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文