如果你认为或者发现了其它问题,可以在后面留言,我们一起来解决它.
Dim httpd
dim Path
Dim ServerPort
Dim b_createport
path =NetBox.ApplicationPath
NetBox.ConfigFile = path & "main.ini"
ServerPort = netBox.Config("Server","Port")
Set httpd = NetBox.CreateObject("NetBox.HttpServer")
IF ServerPort="" THen
ServerPort = 80
netBox.Config("Server","Port") = ServerPort
End If
Shell.Service.Icon = path & netBox.Config("config","ICON")
Shell.Service.RunService "NBWeb", "NetBox Web Server", "NetBox Http Server Sample"
Sub CreatePort()
ServerPort = 0
Do While (ServerPort<1025 Or ServerPort>65535)
If httpd.Create("", 0) = 0 Then
If httpd.LocalPort > 1024 and httpd.LocalPort < 65535 Then
ServerPort=httpd.LocalPort
End If
End If
Loop
End Sub
Sub OnServiceStart()
Set service = Shell.Service
If httpd.Create("", ServerPort) = 0 Then
If b_createport = true Then
Dim b_SaveConfig
b_SaveConfig = Shell.MsgBox ("练习系统检测到目前分配到的端口[" & ServerPort & "]可以使用,是否保存?","保存端口",33)
If b_SaveConfig = 1 Then
netBox.Config("Server","Port") = ServerPort
End If
End If
Set host = httpd.AddHost("", "\")
Set host1 = host.AddFolder("WebExam","\WebExam")
host1.EnableScript = true
host1.AddDefault "default.asp"
host1.AddDefault "default.htm"
httpd.Start
Shell.Execute """" & NetBox.SysInfo("Folder_ProgramFiles") & "\Internet Explorer\IEXPLORE.EXE"" http://localhost:"&ServerPort&"/Your App"
else
Shell.MsgBox "练习系统检测到要使用的端口[" & ServerPort & "]已被别的程序占用,系统将重新分配端口!点击确定继续", "提示信息",64
b_createport = true
CreatePort
OnServiceStart
end if
End Sub
Sub OnServiceStop()
httpd.Close
Shell.Halt 0
Shell.Quit 0
End Sub
Sub OnServicePause()
httpd.Stop
End Sub
Sub OnServiceResume()
httpd.Start
End Sub
dim Path
Dim ServerPort
Dim b_createport
path =NetBox.ApplicationPath
NetBox.ConfigFile = path & "main.ini"
ServerPort = netBox.Config("Server","Port")
Set httpd = NetBox.CreateObject("NetBox.HttpServer")
IF ServerPort="" THen
ServerPort = 80
netBox.Config("Server","Port") = ServerPort
End If
Shell.Service.Icon = path & netBox.Config("config","ICON")
Shell.Service.RunService "NBWeb", "NetBox Web Server", "NetBox Http Server Sample"
Sub CreatePort()
ServerPort = 0
Do While (ServerPort<1025 Or ServerPort>65535)
If httpd.Create("", 0) = 0 Then
If httpd.LocalPort > 1024 and httpd.LocalPort < 65535 Then
ServerPort=httpd.LocalPort
End If
End If
Loop
End Sub
Sub OnServiceStart()
Set service = Shell.Service
If httpd.Create("", ServerPort) = 0 Then
If b_createport = true Then
Dim b_SaveConfig
b_SaveConfig = Shell.MsgBox ("练习系统检测到目前分配到的端口[" & ServerPort & "]可以使用,是否保存?","保存端口",33)
If b_SaveConfig = 1 Then
netBox.Config("Server","Port") = ServerPort
End If
End If
Set host = httpd.AddHost("", "\")
Set host1 = host.AddFolder("WebExam","\WebExam")
host1.EnableScript = true
host1.AddDefault "default.asp"
host1.AddDefault "default.htm"
httpd.Start
Shell.Execute """" & NetBox.SysInfo("Folder_ProgramFiles") & "\Internet Explorer\IEXPLORE.EXE"" http://localhost:"&ServerPort&"/Your App"
else
Shell.MsgBox "练习系统检测到要使用的端口[" & ServerPort & "]已被别的程序占用,系统将重新分配端口!点击确定继续", "提示信息",64
b_createport = true
CreatePort
OnServiceStart
end if
End Sub
Sub OnServiceStop()
httpd.Close
Shell.Halt 0
Shell.Quit 0
End Sub
Sub OnServicePause()
httpd.Stop
End Sub
Sub OnServiceResume()
httpd.Start
End Sub