<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How can I set my custom tool active in ArcMap? in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/how-can-i-set-my-custom-tool-active-in-arcmap/m-p/186001#M4840</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is your custom tool an Add-in? If so, you can always use "My.ArcMap.Application".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Otherwise, I would take a look at one of the walkthroughs (like &lt;A href="http://resources.arcgis.com/en/help/arcobjects-net/conceptualhelp/#/Walkthrough_Create_a_custom_tool/0001000004n5000000/"&gt;Create a custom tool&lt;/A&gt;) which shows how to get the IApplication hook.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;
&lt;P&gt;A private member variable (m_application) is provided and will be set in the OnCreate event (or method) as the hook object from the calling application passed into the DrawGraphicLine class. Since ArcMap consumes the custom .dll, the hook object (ArcMap.exe) is passed into the OnCreate event of the DrawGraphicLine class. This event sets the m_application variable which is of type &lt;A href="http://resources.arcgis.com/en/help/arcobjects-net/componenthelp/index.html#/d/00230000002w000000.htm" rel="/en/help/arcobjects-net/componenthelp/index.html#/d/00230000002w000000.htm" target="_blank"&gt;ESRI.ArcGIS.Framework.IApplication&lt;/A&gt; and begins the entry point for your tool to perform its functionality.&lt;/P&gt;
&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 17 Sep 2014 14:45:26 GMT</pubDate>
    <dc:creator>KenBuja</dc:creator>
    <dc:date>2014-09-17T14:45:26Z</dc:date>
    <item>
      <title>How can I set my custom tool active in ArcMap?</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/how-can-i-set-my-custom-tool-active-in-arcmap/m-p/185999#M4838</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I've tried this snippet:&lt;/P&gt;&lt;P&gt;///&amp;lt;summary&amp;gt;Find a specific tool (or command) in a toolbar and set it to be active.&amp;lt;/summary&amp;gt;&lt;/P&gt;&lt;P&gt;///&amp;nbsp; &lt;/P&gt;&lt;P&gt;///&amp;lt;param name="application"&amp;gt;An IApplication interface.&amp;lt;/param&amp;gt;&lt;/P&gt;&lt;P&gt;///&amp;lt;param name="toolName"&amp;gt;A System.String that is the name of the command to return. Example: "esriFramework.HelpContentsCommand"&amp;lt;/param&amp;gt;&lt;/P&gt;&lt;P&gt;///&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;///&amp;lt;remarks&amp;gt;Refer to the EDN document &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://edndoc.esri.com/arcobjects/9.1/default.asp?URL=/arcobjects/9.1/ArcGISDevHelp/TechnicalDocuments/Guids/ArcMapIds.htm" rel="nofollow" target="_blank"&gt;http://edndoc.esri.com/arcobjects/9.1/default.asp?URL=/arcobjects/9.1/ArcGISDevHelp/TechnicalDocuments/Guids/ArcMapIds.htm&lt;/A&gt;&lt;SPAN&gt; for a listing of available CLSID's and ProgID's that can be used as the toolName parameter.&amp;lt;/remarks&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;public void SetToolActiveInToolBar(ESRI.ArcGIS.Framework.IApplication application, System.String toolName)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp; ESRI.ArcGIS.Framework.ICommandBars commandBars = application.Document.CommandBars;&lt;/P&gt;&lt;P&gt;&amp;nbsp; ESRI.ArcGIS.esriSystem.UID commandID = new ESRI.ArcGIS.esriSystem.UIDClass();&lt;/P&gt;&lt;P&gt;&amp;nbsp; commandID.Value = toolName; // example: "esriArcMapUI.ZoomInTool";&lt;/P&gt;&lt;P&gt;&amp;nbsp; ESRI.ArcGIS.Framework.ICommandItem commandItem = commandBars.Find(commandID, false, false);&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if (commandItem != null)&lt;/P&gt;&lt;P&gt;&amp;nbsp; application.CurrentTool = commandItem;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;Buuuut, I have no idea, how run it. What should I get to ESRI.ArcGIS.Framework.IApplication application?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Sep 2014 10:22:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/how-can-i-set-my-custom-tool-active-in-arcmap/m-p/185999#M4838</guid>
      <dc:creator>SergeyGamayunov</dc:creator>
      <dc:date>2014-09-17T10:22:12Z</dc:date>
    </item>
    <item>
      <title>Re: How can I set my custom tool active in ArcMap?</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/how-can-i-set-my-custom-tool-active-in-arcmap/m-p/186000#M4839</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;"set*", not "get".&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Sep 2014 11:28:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/how-can-i-set-my-custom-tool-active-in-arcmap/m-p/186000#M4839</guid>
      <dc:creator>SergeyGamayunov</dc:creator>
      <dc:date>2014-09-17T11:28:01Z</dc:date>
    </item>
    <item>
      <title>Re: How can I set my custom tool active in ArcMap?</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/how-can-i-set-my-custom-tool-active-in-arcmap/m-p/186001#M4840</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is your custom tool an Add-in? If so, you can always use "My.ArcMap.Application".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Otherwise, I would take a look at one of the walkthroughs (like &lt;A href="http://resources.arcgis.com/en/help/arcobjects-net/conceptualhelp/#/Walkthrough_Create_a_custom_tool/0001000004n5000000/"&gt;Create a custom tool&lt;/A&gt;) which shows how to get the IApplication hook.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;
&lt;P&gt;A private member variable (m_application) is provided and will be set in the OnCreate event (or method) as the hook object from the calling application passed into the DrawGraphicLine class. Since ArcMap consumes the custom .dll, the hook object (ArcMap.exe) is passed into the OnCreate event of the DrawGraphicLine class. This event sets the m_application variable which is of type &lt;A href="http://resources.arcgis.com/en/help/arcobjects-net/componenthelp/index.html#/d/00230000002w000000.htm" rel="/en/help/arcobjects-net/componenthelp/index.html#/d/00230000002w000000.htm" target="_blank"&gt;ESRI.ArcGIS.Framework.IApplication&lt;/A&gt; and begins the entry point for your tool to perform its functionality.&lt;/P&gt;
&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Sep 2014 14:45:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/how-can-i-set-my-custom-tool-active-in-arcmap/m-p/186001#M4840</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2014-09-17T14:45:26Z</dc:date>
    </item>
    <item>
      <title>Re: How can I set my custom tool active in ArcMap?</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/how-can-i-set-my-custom-tool-active-in-arcmap/m-p/186002#M4841</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you, sir &lt;span class="lia-unicode-emoji" title=":grinning_face_with_big_eyes:"&gt;😃&lt;/span&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Sep 2014 03:46:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/how-can-i-set-my-custom-tool-active-in-arcmap/m-p/186002#M4841</guid>
      <dc:creator>SergeyGamayunov</dc:creator>
      <dc:date>2014-09-18T03:46:21Z</dc:date>
    </item>
  </channel>
</rss>

