
'------------------------ 开发时间：2005年5月1日--------------------
Dim httpd
Shell.Service.icon = "\status\on.gif"
Shell.Service.RunService "ASPWebserver", "AspWeb服务器2005", "AspWeb服务器2005 off"

'---------------------- 服务事件开始 ---------------------

Sub OnServiceStart()
    Shell.Service.SetTimer 100
    Set httpd = CreateObject("netbox.HttpServer")

    If httpd.Create("", 8080) = 0 Then
        Set host = httpd.AddHost("", "\wwwroot")
        host.EnableWrite=false
        host.EnableScript = true
        host.AddDefault "default.asp"
        host.AddDefault "default.htm"
        host.AddDefault "default.html"
        host.AddDefault "index.asp"
        host.AddDefault "index.htm"
        host.AddDefault "index.html"

        httpd.Start
    else
    Shell.MsgBox "服务器启动失败，80端口可能被占用!请停止当前WEB服务器或用记事本打开main.box文件修改端口.","错误对话框"
    Shell.Quit 0
    end if
End Sub

Sub OnServiceStop()
    httpd.Close
End Sub

Sub OnServicePause()
    Shell.Service.Icon = "\status\off.gif" 
End Sub

Sub OnServiceResume()
    OnServiceTimer
    httpd.Start
End Sub

Sub OnServiceTimer
	If Shell.Service.icon = "\status\on.gif" Then
		Shell.Service.icon = "\status\on1.gif"
	Else
		Shell.Service.icon = "\status\on.gif"
	End If
End Sub