C++ Daemon?

I can't seem to find out how to write a background/system process that you can't see...
Btw I'm using Windows... I see their/your server thinks I'm using Linux...
Just don't make a window...?
But then it shows up in CMD/Terminal
Filetestingman wrote:
I see their/your server thinks I'm using Linux...

...maybe the server is trying to hint something..? ;o)
But I don't want Linux. I mean I do, but not now. It keeps giving me Linux suggestions.
Back to the question...
For Windows service, there are some Windows specific API you need to call in your application so that it don't show up in CMD/Terminal.

Basically you control your Windows Service via the Control Panel -> Services. I believe there is a ServiceManager that manages all the services. So your program must behave well and react according to the ServiceManager calling your program methods.

Just imagine ServiceManager as a container application and all services "reside" inside this container. Therefore all services must behave when say ServiceManager call you to "stop" "pause" "restart", your service methods must implement accordingly.
I know what the services.msc is/does, but that's just for automatically running programs and other things
I havn't even watched this yet but it might be my answer: http://www.youtube.com/watch?v=bD93DX8Ph-c
Umm... No.
Maybe this will work:
#define _WIN32_WINNT 0x0500
#include <windows.h>
#include <iostream>
int main()
{
HWND hWnd = GetConsoleWindow();
ShowWindow( hWnd, SW_HIDE );
// Some code
return 0;
}
Last edited on
I know what the services.msc is/does, but that's just for automatically running programs and other things


Isn't that what you want ? Auto-run the program and it stay on there acting like a background process until you use Control Panel -> Services to stop or even remove it.

You mean the Windows service is not equivalent to background process? A lot of device drivers we install also uses this feature.

Or you are looking at putting your program in some startup folder ? Then you need to check another set of Windows API that allow you to "nest" your application in the taskbar below right.

No, I just wanted to hide the black console window/cmd/terminal.
Services will help with keeping it running though.
If you don't want the console window, create a Win32 application.
No window will be created until you call CreateWindow.
Ohhhhhh, I think I can do that in MVSC++EE(Microsoft Visual Studio C++ Express Edition)
Thx everyone, I think I got it now

AdiĆ³s
Bye!
Topic archived. No new replies allowed.