How can I run my (Im using C) program as a service so it runs in the background? Is there code to do it?
How can I run my (Im using C) program as a service so it runs in the background? Is there code to do it?
If you compile your program as a windows program and there is no output, it will run in the background and you will not notice it is running. I'm not sure if that is what your asking about though.
- Sean
If cities were built like software is built, the first woodpecker to come along would level civilization.
Black Frog Studios
Do you mean how to make it not appear in the tasklist even?
Just Google It. √
(\ /)
( . .)
c(")(") This is bunny. Copy and paste bunny into your signature to help him gain world domination.
just make it so your do not ShowWindow() so there's not window thats popped up or just find another way to not create the actaul window itself...
Look this up on msdn for more info but heres this copied from it:
BOOL CreateProcess(
LPCTSTR lpApplicationName,
// pointer to name of executable module
LPTSTR lpCommandLine, // pointer to command line string
LPSECURITY_ATTRIBUTES lpProcessAttributes, // process security attributes
LPSECURITY_ATTRIBUTES lpThreadAttributes, // thread security attributes
BOOL bInheritHandles, // handle inheritance flag
DWORD dwCreationFlags, // creation flags
LPVOID lpEnvironment, // pointer to new environment block
LPCTSTR lpCurrentDirectory, // pointer to current directory name
LPSTARTUPINFO lpStartupInfo, // pointer to STARTUPINFO
LPPROCESS_INFORMATION lpProcessInformation // pointer to PROCESS_INFORMATION
);
My program I want to run as a windows SERVICE, it would appear in XP task manager, but it runs in the background like services do. And most code you guys are spewing (heh) I don't like/understand cause I never program actual win32 exe's, my programs are command line.
Looks like you're SCREWED then! j/k, I really have no clue.
Just Google It. √
(\ /)
( . .)
c(")(") This is bunny. Copy and paste bunny into your signature to help him gain world domination.
If you have never programmed for Win32 then I would recomend making a basic windows app and then try to make an app that runs in the background. There are several ways to do that just search around this board, there was a very in length discussion on it a while ago (like when i first signed up here over 2 years ago, but the thread is still around)
I'm looking for the exact same info - command line windows program that needs to run as a service (start when the computer boots as opposed to when someone logs in & preferably doesn't show up in the task list)...
I'm still searching for info, but if anyone knows an answer, feel free to post it.
You need to add a key pointing to your app in the registry, the key is in:
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\Curr entVersion\RunServices