This document is archived and information here might be outdated.  Recommended version.


IGPComHelper Interface (ArcObjects .NET 10.8 SDK)
ArcObjects Help for .NET developers > ArcObjects Help for .NET developers > ArcObjects namespaces > Geoprocessing > ESRI.ArcGIS.Geoprocessing > Interfaces > IG > IGPComHelper Interface
ArcGIS Developer Help

IGPComHelper Interface

Provides access to properties and methods on a Geoprocessing helper object.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Members

Name Description
Method AddToolbox Adds a reference to the specified toolbox to the GeoProcessor.
Read-only property EnvironmentManager The environment manager object associated with the helper.
Method Execute Executes the specified tool.
Method GetParameterName Get the parameter name for a given tool and index.
Method RemoveToolbox Removes the reference to the specified toolbox from the GeoProcessor.

Classes that implement IGPComHelper

Classes Description
GpDispatch Utility object used to execute geoprocessing tools.

Remarks

The IGPComHelper interface provides access to the properties and methods of the GPComHelper object. It is mainly intended for C++ developers to easily execute geoprocessing functions. Use this interface to invoke/create a GPEnvironmentManager object. With ArcGIS 9.2, C++ developers are now recommended to use the new Geoprocessor class.

See also IGeoprocessor

[C++]

The following C ++ code sample shows how to execute a geoprocessing tool using the GPCOMHelper object with ArcGIS 9.0 and ArcGIS 9.1. With ArcGIS 9.2, it is recommended to use the Geoprocessor object.

//Create required objects
IGPComHelperPtr ipComHelper(CLSID_GpDispatch);
IPropertySetPtr ipPropertySet(CLSID_PropertySet);
ITrackCancelPtr ipTrackCancel(CLSID_CancelTracker);
IGPMessagesPtr ipMessages;

//Set the parameter values
//Input Value
VARIANT input;
input.vt = VT_BSTR;
input.bstrVal = ::SysAllocString(L"C:\\workspace\\near1.shp");

//Output Value
VARIANT output;
output.vt = VT_BSTR;
output.bstrVal = ::SysAllocString(L"C:\\workspace\\xbuf.shp");
      
//Buffer Distance Value
VARIANT dist;
dist.vt = VT_BSTR;
dist.bstrVal = ::SysAllocString(L"100");
ipPropertySet->SetProperty(L"in_features", input);
ipPropertySet->SetProperty(L"out_feature_class", output);
ipPropertySet->SetProperty(L"buffer_distance_or_field", dist);    

//Add the Toolbox
ipComHelper->AddToolbox(L"C:\\ArcGIS\\ArcToolbox\\Toolboxes\\Analysis Tools.tbx");

//Execute the tool
ipComHelper->Execute(L"buffer_analysis", ipPropertySet, ipTrackCancel, &ipMessages);