Public Function IISAddWebName(sDisplay As String, sPath As String) As Boolean
'Purpose: 设置IIs
'Desc: sDisplay IIS的显示名称, sPath 安装的路径。
'Name: syh
'Date: 01-05-29
Dim oWebServer As Object
Dim vRootDir As Object
Dim vsubDir As Object
Screen.MousePointer = 11
On Local Error GoTo errorhandle
'lg 01-9-10
NukeApplication sDisplay
Set oWebServer = GetObject("IIS://localhost/w3svc/1")
Set vRootDir = GetObject("IIS://localhost/w3svc/1/root")
Set vsubDir = vRootDir.Create("IIsWebVirtualDir", sDisplay)
vsubDir.AccessRead = True
vsubDir.accesswrite = True
vsubDir.AccessScript = True
vsubDir.Path = sPath
'vsubDir.defaultdoc = "Default.htm" '启动时缺省的文档
vsubDir.EnableDefaultDoc = True '允许默认首页
vsubDir.defaultdoc = "Default.htm, index.htm, default.asp, index.asp"
vsubDir.DirBrowseFlags = False '启动时能浏览目录 vsubDir.EnableDefaultDoc = True
vsubDir.SetInfo
vsubDir.AppCreate True
Set oWebServer = Nothing
Set vsubDir = Nothing
Set vRootDir = Nothing
Screen.MousePointer = 0
IISAddWebName = True
Exit Function
errorhandle:
IISAddWebName = False
Screen.MousePointer = 0
MsgBox "IIS程序没有安装,不能够成功的找到Web服务程序", vbInformation
End '终止设置程序
End FunctionPublic Function IISAddSmtp(sDisplay As String) As Boolean
'Purpose: 设置邮件服务器的名称
'Desc: sDisplay邮件服务的名称
'Name: syh
'Date: 01-05-29
Dim oStmp As Object
Dim othisDomain As Object
'NukeStmp sDisplay
On Error Resume Next
Set oStmp = GetObject("IIS://localhost/SmtpSvc/1/Domain")
If Err.Number <> 0 Then
MsgBox Err.Description
IISAddSmtp = False
Exit Function
End If
Set othisDomain = oStmp.Create("IIsSmtpDomain", sDisplay)
'MsgBox Err.Description
othisDomain.RouteAction = SMTP_ALIAS
othisDomain.SetInfo
Set othisDomain = Nothing
Set oStmp = Nothing
End FunctionPrivate Sub NukeApplication(sDisplay As String)
'Purpose: 查找删除已经存在的Web服务
'Date: 01-05-29
'Name: syh
Dim oRoot As Object
On Error Resume Next
Set oRoot = GetObject(APP_PATH & "/ROOT")
If Err <> 0 Then GoTo NoPath
'oRoot.AppDelete
If Err <> 0 Then GoTo NoWebDir
oRoot.Delete "IIsWebDirectory", sDisplay
If Err <> 0 Then GoTo NoWebDir
SmallSleep
oRoot.SetInfo
SmallSleep
NoPath:
NoWebDir:
Set oRoot = Nothing
End Sub
Private Sub SmallSleep()
Sleep 1000
End SubSet oWebServer = GetObject("IIS://localhost/w3svc/1")是什么意思?
IISAddWebName()和IISAddSmtp()的具体功能是什么?
若会VC,请讲授在VC下怎么实现
'Purpose: 设置IIs
'Desc: sDisplay IIS的显示名称, sPath 安装的路径。
'Name: syh
'Date: 01-05-29
Dim oWebServer As Object
Dim vRootDir As Object
Dim vsubDir As Object
Screen.MousePointer = 11
On Local Error GoTo errorhandle
'lg 01-9-10
NukeApplication sDisplay
Set oWebServer = GetObject("IIS://localhost/w3svc/1")
Set vRootDir = GetObject("IIS://localhost/w3svc/1/root")
Set vsubDir = vRootDir.Create("IIsWebVirtualDir", sDisplay)
vsubDir.AccessRead = True
vsubDir.accesswrite = True
vsubDir.AccessScript = True
vsubDir.Path = sPath
'vsubDir.defaultdoc = "Default.htm" '启动时缺省的文档
vsubDir.EnableDefaultDoc = True '允许默认首页
vsubDir.defaultdoc = "Default.htm, index.htm, default.asp, index.asp"
vsubDir.DirBrowseFlags = False '启动时能浏览目录 vsubDir.EnableDefaultDoc = True
vsubDir.SetInfo
vsubDir.AppCreate True
Set oWebServer = Nothing
Set vsubDir = Nothing
Set vRootDir = Nothing
Screen.MousePointer = 0
IISAddWebName = True
Exit Function
errorhandle:
IISAddWebName = False
Screen.MousePointer = 0
MsgBox "IIS程序没有安装,不能够成功的找到Web服务程序", vbInformation
End '终止设置程序
End FunctionPublic Function IISAddSmtp(sDisplay As String) As Boolean
'Purpose: 设置邮件服务器的名称
'Desc: sDisplay邮件服务的名称
'Name: syh
'Date: 01-05-29
Dim oStmp As Object
Dim othisDomain As Object
'NukeStmp sDisplay
On Error Resume Next
Set oStmp = GetObject("IIS://localhost/SmtpSvc/1/Domain")
If Err.Number <> 0 Then
MsgBox Err.Description
IISAddSmtp = False
Exit Function
End If
Set othisDomain = oStmp.Create("IIsSmtpDomain", sDisplay)
'MsgBox Err.Description
othisDomain.RouteAction = SMTP_ALIAS
othisDomain.SetInfo
Set othisDomain = Nothing
Set oStmp = Nothing
End FunctionPrivate Sub NukeApplication(sDisplay As String)
'Purpose: 查找删除已经存在的Web服务
'Date: 01-05-29
'Name: syh
Dim oRoot As Object
On Error Resume Next
Set oRoot = GetObject(APP_PATH & "/ROOT")
If Err <> 0 Then GoTo NoPath
'oRoot.AppDelete
If Err <> 0 Then GoTo NoWebDir
oRoot.Delete "IIsWebDirectory", sDisplay
If Err <> 0 Then GoTo NoWebDir
SmallSleep
oRoot.SetInfo
SmallSleep
NoPath:
NoWebDir:
Set oRoot = Nothing
End Sub
Private Sub SmallSleep()
Sleep 1000
End SubSet oWebServer = GetObject("IIS://localhost/w3svc/1")是什么意思?
IISAddWebName()和IISAddSmtp()的具体功能是什么?
若会VC,请讲授在VC下怎么实现
IISAddWebName的功能是添加一个Web的虚拟目录
IISAddSmtp的功能是添加一个smtp服务器在VC下实现同理。