使用MSDN中描述的方法注册Windows服务(ms-help://MS.VSCC.v80/MS.MSDN.v80/MS.WIN32COM.v10.en/dllproc/base/createservice热媒),并使用类似的代码所提供的例子:Windows服务查询
schService = CreateService(
schSCManager, // SCManager database
TEXT("Sample_Srv"), // name of service
lpszDisplayName, // service name to display
SERVICE_ALL_ACCESS, // desired access
SERVICE_WIN32_OWN_PROCESS, // service type
SERVICE_DEMAND_START, // start type
SERVICE_ERROR_NORMAL, // error control type
szPath, // path to service's binary
NULL, // no load ordering group
NULL, // no tag identifier
NULL, // no dependencies
NULL, // LocalSystem account
NULL); // no password
我的问题是,虽然服务注册和完美的作品,在msconfig.msc服务已经“不采取任何行动”中的恢复选项。有没有一种方法可以通过编程方式改变它,以便在失败时重新启动?