开发者

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine()

I'm trying to create an application that adheres to the following:

  • No Taskbar
  • No console or form window
  • Can utilize Console.WriteLine(). (i.e. If someone executes the app from command pr开发者_高级运维ompt it will actually write to that console.)

The problem is if I create a Windows Form (or WPF) application I can have it so that there is no taskbar, console or window show up, but Console.WriteLine() does nothing. If I create a console app, it writes to the console, but I can't figure out how to hide it (and if I did hide it, would it write to the command prompt window?)...

How do I do this?


Just create a standard console application. It is the callers responsibility to hide the window caused by the program (from How to run a C# console application with the console hidden ):

System.Diagnostics.ProcessStartInfo start =
      new System.Diagnostics.ProcessStartInfo();     
start.FileName = dir + @"\Myprocesstostart.exe";
start.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜