Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to "daemonize" a Win32 program

Status
Not open for further replies.

Clairvoyant1332

Programmer
May 21, 2003
147
US
In UNIX environments, a process can be put in the background by first calling fork(), which creates a new process identical to the caller. The new process then calls setsid() or setpgrp() to detach from the terminal, and the parent process exits. This results in the command issued by the user coming right back to the shell, but now a background process is running.

What's the equivalent in Visual C++? Does it have to be set up as a service or is there a simpler way to do it?
 
Every Windows program which doesn't send any window is running in the background. The only caveat is, you mustn't use main as entrypoint, because with that your program allocates a console window (dos-box), even when not needed.
Use entrypoint WinMain instead.


Marcel
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top