<?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 Application/Map Hook - Obtaining a reference to the currently loaded map in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/application-map-hook-obtaining-a-reference-to-the/m-p/392951#M10482</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm developing a customization for ArcMap 10 using C#.NET and ArcObjects and am trying to access the current map.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm fleshing out this customization: &lt;/SPAN&gt;&lt;A href="http://help.arcgis.com/en/sdk/10.0/arcobjects_net/conceptualhelp/0001/0001000004s8000000.htm"&gt;http://help.arcgis.com/en/sdk/10.0/arcobjects_net/conceptualhelp/0001/0001000004s8000000.htm&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Essentially, I'd like a high-level overview of application hooks and how they can be used to get a reference to the current map (I don't need the current application reference as of yet, but if it contains the map element itself, I can deal with that instead). I don't have any Windows development experience and this concept is new to me. I've tried adding the OnCreate method, but that didn't work, and I wasn't sure to which file it should be added.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If anyone could give me any insight into how application hooks work and how they are integrated into ArcObjects customizations it'd be &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;greatly&lt;/SPAN&gt;&lt;SPAN&gt; appreciated.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 12 Apr 2011 12:01:29 GMT</pubDate>
    <dc:creator>JordanMacDonald</dc:creator>
    <dc:date>2011-04-12T12:01:29Z</dc:date>
    <item>
      <title>Application/Map Hook - Obtaining a reference to the currently loaded map</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/application-map-hook-obtaining-a-reference-to-the/m-p/392951#M10482</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm developing a customization for ArcMap 10 using C#.NET and ArcObjects and am trying to access the current map.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm fleshing out this customization: &lt;/SPAN&gt;&lt;A href="http://help.arcgis.com/en/sdk/10.0/arcobjects_net/conceptualhelp/0001/0001000004s8000000.htm"&gt;http://help.arcgis.com/en/sdk/10.0/arcobjects_net/conceptualhelp/0001/0001000004s8000000.htm&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Essentially, I'd like a high-level overview of application hooks and how they can be used to get a reference to the current map (I don't need the current application reference as of yet, but if it contains the map element itself, I can deal with that instead). I don't have any Windows development experience and this concept is new to me. I've tried adding the OnCreate method, but that didn't work, and I wasn't sure to which file it should be added.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If anyone could give me any insight into how application hooks work and how they are integrated into ArcObjects customizations it'd be &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;greatly&lt;/SPAN&gt;&lt;SPAN&gt; appreciated.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Apr 2011 12:01:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/application-map-hook-obtaining-a-reference-to-the/m-p/392951#M10482</guid>
      <dc:creator>JordanMacDonald</dc:creator>
      <dc:date>2011-04-12T12:01:29Z</dc:date>
    </item>
    <item>
      <title>Re: Application/Map Hook - Obtaining a reference to the currently loaded map</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/application-map-hook-obtaining-a-reference-to-the/m-p/392952#M10483</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The hook is meant to support different types of application for the same code.&amp;nbsp; When you develop with ArcGIS desktop, you register your components (ESRIRegAsm.)&amp;nbsp; That places a reference to the component you developed in the registry in a category.&amp;nbsp; There are many categories, some apply only to arcmap, others apply to ArcMap, Globe, Catalog, Engine, etc.&amp;nbsp; When any of these applications start up, they read the registry to see which components apply to it.&amp;nbsp; At various other times components are read from the registry and created.&amp;nbsp; For a command or and extension, that is when the oncreate will be called by the ArcMap application.&amp;nbsp; In your development, you need to be able to get a reference to the ArcMap application or to the map, this is what the hook is for, it allows you to get a handle or hook into the application that created the component.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;A command for example could be registered to work in any ArcGIS application.&amp;nbsp; In that case, when the ICommand.OnCreate is invoked, any of these applications or hooks could be passed into to the command.&amp;nbsp; You need to be able to handle the different possibilities,&amp;nbsp; the hookhelper is a generic way to handle any type of application, it applies to all of them.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Apr 2011 14:31:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/application-map-hook-obtaining-a-reference-to-the/m-p/392952#M10483</guid>
      <dc:creator>AlexanderGray</dc:creator>
      <dc:date>2011-04-12T14:31:13Z</dc:date>
    </item>
    <item>
      <title>Re: Application/Map Hook - Obtaining a reference to the currently loaded map</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/application-map-hook-obtaining-a-reference-to-the/m-p/392953#M10484</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Wow, thanks, that explanation helped out a lot.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;There was already an OnCreate implementation in my current codebase, but it's in a file called AddEXTCLSID.cs, which is the main file that's loaded during ArcMap startup. I essentially associate this component with a feature class in the editor and my actual implementation (StreetName.cs) is used automatically when editing address points in the configured feature class.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What I &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;can't&lt;/SPAN&gt;&lt;SPAN&gt; seem to find is where my implementation class is instantiated. There's no call to its constructor anywhere in my codebase, and since I don't know where it's being instantiated, I don't know how I can pass a reference to the current IApplication, which resides in the AddEXTCLSID object, to my actual implementation class. Since it's declared as a private member variable, and since my implementation class doesn't have a reference to the instantiated object anyway, I don't see how I can access this.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any ideas?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Apr 2011 18:00:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/application-map-hook-obtaining-a-reference-to-the/m-p/392953#M10484</guid>
      <dc:creator>JordanMacDonald</dc:creator>
      <dc:date>2011-04-12T18:00:34Z</dc:date>
    </item>
    <item>
      <title>Re: Application/Map Hook - Obtaining a reference to the currently loaded map</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/application-map-hook-obtaining-a-reference-to-the/m-p/392954#M10485</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The example you reference is for a ClassExtension.&amp;nbsp; The command just registers the class extension to the featureclass.&amp;nbsp; From that point on, the feature class has a reference to the an extension id (guid, I think) in the database.&amp;nbsp; So when the featureclass is edited or identified or whatever, Arcmap checks if the featureclass is registered as having a class extension, then looks in the windows registry for where the code for that extension is and loads it.&amp;nbsp; You cannot instantiate the code your self, that is done by arcmap/arcobjects for you.&amp;nbsp;&amp;nbsp; The class extension init method passes a reference to the featureclass.&amp;nbsp; You wouldn't want to use a reference to the application directly in a class extension since, in some cases there might not be one.&amp;nbsp; It is possible to write a console exe that uses arcobjects and edits or does something to a featureclass that has a class extension that will get instantiated at run time by arcobjects.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Class extension are a little tricky to work with, I suggest you read this part in the help.&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://help.arcgis.com/en/sdk/10.0/arcobjects_net/conceptualhelp/index.html#/Creating_class_extensions/000100000201000000/"&gt;http://help.arcgis.com/en/sdk/10.0/arcobjects_net/conceptualhelp/index.html#/Creating_class_extensions/000100000201000000/&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Apr 2011 20:52:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/application-map-hook-obtaining-a-reference-to-the/m-p/392954#M10485</guid>
      <dc:creator>AlexanderGray</dc:creator>
      <dc:date>2011-04-12T20:52:19Z</dc:date>
    </item>
    <item>
      <title>Re: Application/Map Hook - Obtaining a reference to the currently loaded map</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/application-map-hook-obtaining-a-reference-to-the/m-p/392955#M10486</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks for the detailed explanation; it definitely helps clarify what's happening with my editor extension.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;As a result of your explanation I did some additional investigation and realized that I can call get_Datasets on the IWorkspace object that I &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;do&lt;/SPAN&gt;&lt;SPAN&gt; have a reference to, which will give me access to pretty much anything in the current document.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks a million for all of your help; it's been greatly appreciated.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Apr 2011 13:06:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/application-map-hook-obtaining-a-reference-to-the/m-p/392955#M10486</guid>
      <dc:creator>JordanMacDonald</dc:creator>
      <dc:date>2011-04-13T13:06:30Z</dc:date>
    </item>
  </channel>
</rss>

