Dev-C++在没有 GUI 的情况下在后台运行程序
我最近开始学习 C++,以便接触那些没有 .net 的人。我需要在后台运行我的程序(没有向用户提供任何视觉指示,因此没有窗口或命令)。我知道在 C# 中有多种方法可以做到这一点,但我不知道如何在 C++(特别是 Dev-C++)中做到这一点。非常感谢任何帮助。
I recently began learning C++ in order to reach people w/o .net. I need to run my program in the background(without any visual indication to the user so no window or cmd). I know there a various methods to do this In C#, but I don't know how to do this in C++ (specifically Dev-C++). Any help is greatly appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
首先,您不应该使用 Dev-C++。如果您确实不想使用 Visual Studio(为什么不?它是免费的!),那么 Code::Blocks 或 Eclipse 或其他东西是更好的选择。 Dev-C++ 已经有 5 年没有更新了……
在 C++ 中创建后台进程的方式与 C# 基本相同,只是没有 C# 拥有的处理大部分工作的庞大类库为你。
您的主要选择是Windows 服务,或者创建常规 Windows 应用程序并只是不显示任何窗口...您选择哪一个取决于您的具体要求(您是否希望它在没有人登录的情况下运行,或者您希望它与登录用户关联等)
First of all, you shouldn't be using Dev-C++. If you really don't want to use Visual Studio (why not? it's free!) then Code::Blocks or Eclipse or something is a better choice. Dev-C++ hasn't been updated in like 5 years...
The ways of creating background processes in C++ is basically the same as in C#, you just don't get the enormous class library that C# has which handles most of the work for you.
Your main choices are windows services, or creating a regular windows application and simply not displaying any windows... which one you choose depends on your specific requirements (do you want it run even when no one is logged in, or do you want it associated with a logged-in user, etc)
您需要创建 Windows GUI 应用程序而不是控制台应用程序(否则将显示控制台窗口)。然后,不要创建任何窗口。
You need to be creating a Windows GUI application and not a console application (or else the console window will show). Then, just don't create any windows.