如何开发在.NET中后台运行的程序? [英] how to develop a program that runs in the background in .NET?
问题描述
我已经在C#一个小程序,我想在后台运行,当按一定的组合键就应该只出现。什么样的.NET类我应该使用的。
I have made a small program in C# that i want to run in the background and it should only appear when a certain key combination is pressed. What kind of .NET Classes should i use.
若干准则的实施将是非常赞赏。
Some Guidelines for its implementation would be very appreciated.
谢谢
推荐答案
有至少三种方法可以做到这一点:
There are at least three ways to do this:
-
经典 Windows服务应用程序。 在C#创建基本Windows服务,从CodeProject上的文章会帮助你。在这种情况下,你使用
System.ServiceProcess
命名空间。顺便说一句,在这种情况下,你应该阅读从MSDN System.ServiceProcess命名空间的文章。下面是这短短的一句话:
Classic Windows Service application. "Creating a Basic Windows Service in C#" article from CodeProject will help you. In that case you use
System.ServiceProcess
namespace. BTW, in that case you should read "System.ServiceProcess Namespace" article from MSDN. Here is a short quote from it:
System.ServiceProcess命名空间提供类,使您可以实现,安装和控制Windows服务应用程序。服务是长时间运行的,如果没有一个用户界面运行可执行文件。
The System.ServiceProcess namespace provides classes that allow you to implement, install, and control Windows service applications. Services are long-running executables that run without a user interface.
内存驻留程序。但是,这几乎是不可能用C#做的。使用C ++或更好的C用于此目的,如果你想。如果你想自己查找,只需用关键字 TSR
。
Memory-Resident Program. But this is almost impossible to do with C#. Use C++ or better C for this purpose, if you want. If you want to search by yourself, just use keyword TSR
.
最后一个是一荤一。只要创建一个无形的C#应用程序并尝试来隐藏它从任务管理器。
Last one is a dirty one. Just create a formless C# application and try to hide it from Task Manager.
这篇关于如何开发在.NET中后台运行的程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!