Please use:
RegisteServiceProcess(NULL, RSP_SIMPLE_SERVICE);
To access RegisterServiceProcess, retrieve a function pointer using
GetProcAddress() on KERNEL32.DLL.
RegisterServiceProcess
----------------------
DWORD RegisterServiceProcess(
DWORD dwProcessId, // process identifier
DWORD dwServiceType // type of service
);
Parameters:
- dwProcessId: Specifies the identifier of the process to register as a
service process or NULL to register the current process. An
application receives the process ID when it uses CreateProcess() to
start the application.
- dwServiceType: One of the following values:
Define Value Meaning
RSP_SIMPLE_SERVICE 0x00000001 Registers the process as a
simple service process.
RSP_UNREGISTER_SERVICE 0x00000000 Unregisters the process as a
service process.
Return Value:
The return value is 1 if successful or 0 if an error occurs.
Note: when your application exit, you should call this function again to unregister yourself,
or it will start automatically next you start windows,