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.
If anyone could give me any insight into how application hooks work and how they are integrated into ArcObjects customizations it'd be greatly appreciated.
The hook is meant to support different types of application for the same code. When you develop with ArcGIS desktop, you register your components (ESRIRegAsm.) That places a reference to the component you developed in the registry in a category. There are many categories, some apply only to arcmap, others apply to ArcMap, Globe, Catalog, Engine, etc. When any of these applications start up, they read the registry to see which components apply to it. At various other times components are read from the registry and created. For a command or and extension, that is when the oncreate will be called by the ArcMap application. 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.
A command for example could be registered to work in any ArcGIS application. In that case, when the ICommand.OnCreate is invoked, any of these applications or hooks could be passed into to the command. You need to be able to handle the different possibilities, the hookhelper is a generic way to handle any type of application, it applies to all of them.
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.
What I can't 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.
The example you reference is for a ClassExtension. The command just registers the class extension to the featureclass. From that point on, the feature class has a reference to the an extension id (guid, I think) in the database. 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. You cannot instantiate the code your self, that is done by arcmap/arcobjects for you. The class extension init method passes a reference to the featureclass. 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. 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.
Thanks for the detailed explanation; it definitely helps clarify what's happening with my editor extension.
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 do have a reference to, which will give me access to pretty much anything in the current document.
Thanks a million for all of your help; it's been greatly appreciated.