今天要在安装包中安装一个service and 启动 ,
卸载时要停止 and uninstall。
查了以前公司的代码,发现可以这样做。
安装service:
if(LaunchAppAndWait( 【service 路径+name】,"/Service", LAAW_OPTION_WAIT )<0)then
MessageBox("Create service fail",INFORMATION);
endif;
启动service:
if(ServiceStartService("service name", "")< ISERR_SUCCESS)then
MessageBox("Start service fail",INFORMATION);
endif;
停止service:
if(ServiceStopService( "service name" )< ISERR_SUCCESS)then
MessageBox("stop service fail",INFORMATION);
endif;
卸载service:
if(LaunchAppAndWait( 【service 路径+name】,"/UnregServer", LAAW_OPTION_WAIT )<0)then
MessageBox("uninstall service fail",INFORMATION);
endif;