Function OpenFeatureClass2(ByVal strPath AsString, ByVal strName AsString) As IFeatureClass OnErrorGoTo ErrHandle '/定义 工作空间 接口 Dim pWorkSpace As IWorkspaceFactory '/用ShapeFile工作空间实例来实行该接口 Set pWorkSpace =New ShapefileWorkspaceFactory '/工作空间下面有图元工作空间,定义这样一个接口 Dim pFeatureWorkSpace As IFeatureWorkspace '/用工作空间打开某Shape文件,返回这样一个图元工作空间 Set pFeatureWorkSpace = pWorkSpace.OpenFromFile(strPath, 0) '/图元类接口的实现,用图元工作空间的OpenFeatureClass 实现 OpenFeatureClass2 = pFeatureWorkSpace.OpenFeatureClass(strName) ErrHandle: Set OpenFeatureClass2 =Nothing End Function
Function OpenFeatureClass2(ByVal strPath As String, ByVal strName As String) As IFeatureClassOn Error GoTo ErrHandle /定义 工作空间 接口 Dim pWorkSpace As IWorkspaceFactory /用ShapeFile