Daemonizing a console app

Is there a way to run a console program and have it pushed into a background process

VC# Express doesn't allow services to be created, so I'm trying to figure out another way to accomplish this.

Any ideas or way to put a console app in the background

Thanks!


Answer this question

Daemonizing a console app

  • GSchaefer

    You can still write a windows service ...

    http://www.webessence.nl/artikelen/.NET/Create-a-windows-service/

    There is nothing "magic" that visual studio does for you, you can in fact do it all without visual studio.

    Cheers,

    Greg


  • Ben Zaaiman

    I guess we could just make a winforms app and hide the window and display a tray icon.

    I know in linux you could append an ampersand to put the process in the background, i.e.

    app.exe &

  • skimum

    Look at the Process class in .net. There is options for Startup like WindowStyle and what not. You can hide it etc.
  • RFOG

    the same problem for me,
    i need to keep running an application in background and make a tray icon animated when
    some events occur on the "deamon"...


  • VYV

    ok, i found it:

    if you want to start the application minimized you have only to set in the Form properties tab
    the WindowState = Minimized

    and then if you want to put it in the tray bar instead of the task bar all you have to do is
    only to put a NotifyIcon component to your app and use this code to switch:

    if (WindowState == FormWindowState.Minimized)
    {
    ShowInTaskbar = false;
    notifyIcon1.Visible = true;
    }
    else
    {
    ShowInTaskbar = true;
    notifyIcon1.Visible = false;
    }

    hope this will be useful for you too.


  • B Lambert

    That was exactly what I was looking for.

    Thanks Greg!


  • Daemonizing a console app