我在VB6.0上学习开发supermap,从例子上烤下 一段代码,例子本身运行良好,
但到我的程序上就提示“实时错误:-2147417848(80010108)自动化错误”
Private Sub btnBuffer_Click() '生成Buffer
Dim objGeometry As soGeometry
Dim objGeoRegion As soGeoRegion
Dim objGeoPoint As soGeoPoint
Dim objRecordset As soRecordset
Dim objStyle As New soStyle
SuperMap.TrackingLayer.ClearEvents
With objStyle
.BrushStyle = 2
.BrushBackTransparent = True
.PenColor = vbDesktop
.PenWidth = 7
End With
If SuperMap.selection.Count = 0 Then
MsgBox "请先在图中选择一个对象!", vbInformation, "示范"
Else
Set objRecordset = SuperMap.selection.ToRecordset(True)
Set objGeometry = objRecordset.GetGeometry()
If objGeometry.Type = scgPoint Then
Set objGeoPoint = objGeometry
Set objGeoRegion = objGeoPoint.Buffer(20, 40)
ElseIf objGeometry.Type = scgRegion Then
Set objGeoRegion = objGeometry
Set objGeoRegion = objGeoRegion.Buffer(20, 40)
End If
If objGeometry Is Nothing Then
MsgBox "错误!", vbInformation, "示范"
Else
SuperMap.TrackingLayer.AddEvent objGeoRegion, objStyle, "" “实时错误:-2147417848(80010108)自动化错误”
SuperMap.Refresh
End If
End If
Set objGeometry = Nothing
Set objGeoPoint = Nothing
Set objGeoRegion = Nothing
Set objRecordset = Nothing
Set objStyle = Nothing
End Sub
Private Sub btnSelect_Click()
'选择
bAnalyse = False
SuperMap.Action = scaSelect
End Sub
当运行到SuperMap.TrackingLayer.AddEvent objGeoRegion, objStyle, ""时出现以上错误
请问是怎么回事?