I want to have a certain process always running in the background so it will be viewable in the Task Manager of windows, with the specific name I give it.
The process shouldn't do anything really, all I care about is to see the process name whenever I open the task manager and choose "processes".
One way to achieve this is to copy Notepad.exe , change its name to something and then run it. The problem is I don't want to have an ope开发者_StackOverflown window of notepad everytime I'm using the PC. I need it to run on background.
If it matters, I have Windows 7.
Thank you.
You are looking for something like this:
#include <windows.h>
int APIENTRY _tWinMain(
HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow
)
{
MSG msg;
while (GetMessage(&msg, NULL, 0, 0))
return 0;
}
This is the most simple Windows program. It does absolutely nothing and does not consume CPU.
I can't imagine why you want it, but this is what you describe!
Here's a minimal C# version:
static class Program
{
[System.STAThread]
static void Main()
{
System.Threading.Thread.Sleep(System.Threading.Timeout.Infinite);
}
}
You can compile this from the command line:
csc /target:winexe MyProg.cs
Well if a minimized DOS window doesn't bother you then this DOS command will be very light weight and will do the job for you: start /min more
精彩评论