Search code examples
c++cbackgroundinvisiblesilent

How to make a simple Hello World "invisible" in Windows (C/C++)


Hello there i would like to know if it is possible to make a simple Hello World program in Windows (and then advance to actual ones) invisible. By that I mean, when I execute the program there will be no graphical indication whatsoever. No cmd printing "Hello world", no taskbar label, no system tray icon,nothing. I want the program to execute silently without bothering me.

So what am I thinking here people? Is that doable? Would it be like a service? I have no idea.

I would like to code it in C/C++ btw.


Solution

  • How you deal with this depends on the kind of Windows application you have.

    If you want a program to run when you boot and stop when you shut down, then pursue writing a Windows Service, which is doable, but is not as simple as writing a regular user-mode application. Debugging a service lies somewhere in between a regular application and a device driver, more like an application, but you have to use Microsoft template hooks so you can gain debugging control.

    If you simply want a silent console and it's a Windows application (main window and all that) you can create the window so it does not display initially.

    If it is a console application, you should be able to redirect the output of the console. There are Win32 library routines to manipulate a console, including closing the window, so the application can run "silently". Here is a link to those functions.

    http://msdn.microsoft.com/en-us/library/windows/desktop/ms682073%28v=vs.85%29.aspx