隐藏一个C程序在Windows操作系统控制台 [英] Hide the console of a C program in the Windows OS
本文介绍了隐藏一个C程序在Windows操作系统控制台的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想隐藏我的C控制台时,我跑我的应用程序。我怎样才能让我的应用程序在后台运行?
I want to hide my console of C when I run my application. How can I make my application run in the background?
推荐答案
与程序的main()
默认情况下被编译成子系统:控制台应用程序,并得到一个控制台窗口。如果您拥有自己的应用程序启动其他进程,你可以通过以下方法之一修改它们是窗口应用程序:
Programs with main()
by default are compiled as SUBSYSTEM:CONSOLE applications and get a console window. If you own the other processes your application is starting, you could modify them to be windowed applications by one of the following methods:
- 修改他们使用
的WinMain()
而不是的main()
。这是典型的方法,但需要修改code。 (如果使用的原因的main()
是容易获得ARGC
/argv的
,MSVC提供全球__ ARGC
/__ argv的
等价窗口应用程序。) - 通过
显式指定子系统和入口点/子系统:WINDOWS / ENTRY:主
参数LINK.EXE
- 使用
editbin.exe
来改变这个事实后,子系统的类型。如果你没有源$ C $ C接入催生了这个过程可能会有用。
- Modify them to use
WinMain()
instead ofmain()
. This is the typical approach but requires modifying code. (If the reason for usingmain()
is for easy access toargc
/argv
, MSVC provides global__argc
/__argv
equivalents for windowed applications.) - Explicitly specifying the subsystem and entry point via
/SUBSYSTEM:WINDOWS /ENTRY:main
arguments tolink.exe
. - Use
editbin.exe
to change the subsystem type after the fact. This one might be useful if you don't have source code access to the spawned processes.
这篇关于隐藏一个C程序在Windows操作系统控制台的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文