[C#]
protected override void OnClick()
{
//Set a reference to the IGPCommandHelper2 interface.
IGPToolCommandHelper2 pToolHelper = new GPToolCommandHelperClass()as
IGPToolCommandHelper2;
//Set the tool you want to invoke.
string toolboxName = @
"<ArcGIS install directory>ArcToolboxToolboxesAnalysis Tools.tbx";
pToolHelper.SetToolByName(toolboxName, "Buffer");
//Create the messages object and a bool to pass to the InvokeModal method.
IGPMessages msgs;
msgs = new GPMessagesClass();
bool pok = true;
//Invoke the tool.
pToolHelper.InvokeModal(0, null, out pok, out msgs);
}
//============================
using System;
using System.Drawing;
using System.Runtime.InteropServices;
using ESRI.ArcGIS.ADF.BaseClasses;
using ESRI.ArcGIS.ADF.CATIDs;
using ESRI.ArcGIS.Controls;
using System.Windows.Forms;
using ESRI.ArcGIS.Geodatabase;
//using ESRI.ArcGIS.GeoDatabaseUI;
using ESRI.ArcGIS.Geometry;
using ESRI.ArcGIS.esriSystem;
using ESRI.ArcGIS.ArcMapUI;
using ESRI.ArcGIS.SystemUI;
using ESRI.ArcGIS.Carto;
using ESRI.ArcGIS.DataSourcesFile;
using ESRI.ArcGIS.DataSourcesRaster;
using ESRI.ArcGIS.Output;
using ESRI.ArcGIS.Display;
using System.IO;
using ESRI.ArcGIS.Geoprocessor;
using ESRI.ArcGIS.Geoprocessing;
using ESRI.ArcGIS.GeoprocessingUI;
private void myinfo()
{
IGPToolCommandHelper2 pToolHelper = new GPToolCommandHelperClass() as
IGPToolCommandHelper2;
//Set the tool you want to invoke.
string toolboxName = @"D:Program Files (x86)ArcGISDesktop10.0ArcToolboxToolboxesAnalysis Tools.tbx";
pToolHelper.SetToolByName(toolboxName, "Buffer");
//Create the messages object and a bool to pass to the InvokeModal method.
IGPMessages msgs;
msgs = new GPMessagesClass();
bool pok = true;
//Invoke the tool.
pToolHelper.InvokeModal(0, null, out pok, out msgs);
}