在installshield中如何创建service and 启动 停止 service

来源:互联网 发布:新飞狐软件下载 编辑:程序博客网 时间:2024/05/24 01:44

今天要在安装包中安装一个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;