试试看:
下面是我试过的Delphi中的定义:
const
RSP_SIMPLE_SERVICE = $00000001;
RSP_UNREGISTER_SERVICE = $00000000;
// Parameter dwProcessId can be 0, same effect as GetCurrentProcessId
// Return Values: True(1) means success
function RegisterServiceProcess(dwProcessId, dwServiceType: DWord): Bool;
stdcall;
// Place in "implementation" session
function RegisterServiceProcess;
external 'Kernel32.dll' Name 'RegisterServiceProcess';
// Example:
// RegisterServiceProcess(0, RSP_SIMPLE_SERVICE);
// RegisterServiceProcess(0, RSP_UNREGISTER_SERVICE);