<?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: Interfaces from the same coclass, why some need explicit QI, some don't? in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/interfaces-from-the-same-coclass-why-some-need/m-p/119781#M3111</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am not sure how to tell which is the default interface, I have never really thought of that.&amp;nbsp; I guess I blindly cast when the compiler complains.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I don't use the OMDs much.&amp;nbsp; I remember looking at them 7-8 years ago in confusion.&amp;nbsp; I know people who swear by them but I am not a visual person and I find there are far too many objects and interfaces and links between OMDs and assemblies, the OMDs are just not for me.&amp;nbsp; I use the help files installed with the dev kit or the online ones.&amp;nbsp; If that fails I look in this forum or on google, the OMD is pretty much the last place I look.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 21 Jun 2011 16:09:00 GMT</pubDate>
    <dc:creator>AlexanderGray</dc:creator>
    <dc:date>2011-06-21T16:09:00Z</dc:date>
    <item>
      <title>Interfaces from the same coclass, why some need explicit QI, some don't?</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/interfaces-from-the-same-coclass-why-some-need/m-p/119776#M3106</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I try to create a new map document in C# with the following code and cast it to an interface, while casting to IDocument I can implicitly cast to: IDocument iDoc= new MxDocument(); however, I need explicitly cast for the following interface: IMxDocument IMxDoc = new MxDocument() as IMxDocument. Is there any particular reason that one interface can implicit cast but the other can't?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Also, from the attached OMD, how can I tell that IDocument is defined in Framework assembly rather than ArcMapUI assembly, is this a bug for this OMD? &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for your input.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Wei&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 19 Jun 2011 21:42:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/interfaces-from-the-same-coclass-why-some-need/m-p/119776#M3106</guid>
      <dc:creator>weiliang</dc:creator>
      <dc:date>2011-06-19T21:42:29Z</dc:date>
    </item>
    <item>
      <title>Re: Interfaces from the same coclass, why some need explicit QI, some don't?</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/interfaces-from-the-same-coclass-why-some-need/m-p/119777#M3107</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;If memory serves me IDocument is the default interface for the mxdocumentclass.&amp;nbsp; The cast is not necessary.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://edndoc.esri.com/arcobjects/9.1/ExtendingArcObjects/Ch02/CodingInterfaces.htm"&gt;http://edndoc.esri.com/arcobjects/9.1/ExtendingArcObjects/Ch02/CodingInterfaces.htm&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The IDocument is in the framework namespace and the IMxDocument is in the ArcMapUI namespace.&amp;nbsp; IDocument is a generic interface implemented by other types of document such as a ArcGlobe document (GMxDocument), ArcCatalog document (GxDocument), ArcScene (SxDocument)&amp;nbsp; so it has to be a generic namespace implemented by all these applications.&amp;nbsp; IMxDocument interface has methods and properties specific to the an ArcMap Document (*.mxd) it is only implemented by an MxDocumentClass in ArcMap.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Jun 2011 11:54:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/interfaces-from-the-same-coclass-why-some-need/m-p/119777#M3107</guid>
      <dc:creator>AlexanderGray</dc:creator>
      <dc:date>2011-06-20T11:54:49Z</dc:date>
    </item>
    <item>
      <title>Re: Interfaces from the same coclass, why some need explicit QI, some don't?</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/interfaces-from-the-same-coclass-why-some-need/m-p/119778#M3108</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Many thanks for your help, Alexander. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;However, from the OMD (or other places), how can you tell IDocument is the default interface rather than IMxDocument? &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Also, from the attached OMD, how can I tell IDocument is defined in Framework assembly (I thought there should be a prefix in this interface name should it defined in other assembly. Example: esriCarto.IMapDocument ).&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Besides, is there a way you can tell one interface is generic while the other isn't?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Wei&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Jun 2011 14:36:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/interfaces-from-the-same-coclass-why-some-need/m-p/119778#M3108</guid>
      <dc:creator>weiliang</dc:creator>
      <dc:date>2011-06-20T14:36:08Z</dc:date>
    </item>
    <item>
      <title>Re: Interfaces from the same coclass, why some need explicit QI, some don't?</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/interfaces-from-the-same-coclass-why-some-need/m-p/119779#M3109</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You can find which library a given interface or class is in by searching the help.&amp;nbsp; For example:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://help.arcgis.com/en/sdk/10.0/arcobjects_net/componenthelp/index.html#//000v000001p2000000"&gt;http://help.arcgis.com/en/sdk/10.0/arcobjects_net/componenthelp/index.html#//000v000001p2000000&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The underlying machine here is COM which defines the metadata using a type library.&amp;nbsp; On my machine, the ESRI type libraries are in C:\Program Files (x86)\ArcGIS\com.&amp;nbsp; If you use the OleView utility (which comes with Visual Studio - mine is C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\OleView.Exe) you can view the contents of the library.&amp;nbsp; When I open esriArcMapUI.olb and search for MxDocument this is what I found:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; [&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; uuid(006B1AFE-C66C-11D0-B94C-080009EE4E51),&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; helpstring("ESRI Mx Document."),&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; helpcontext(0x00002723)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; coclass MxDocument {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [default] interface IDocument;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; interface IMxDocument;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; interface IDocumentDirty;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; interface IDocumentDirty2;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; interface IPropertySupport;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; interface IChangeLayout;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; interface IDocumentDefaultSymbols;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; interface IContentsViewEdit;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; interface IDataGraphs;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; interface IDataGraphCollection;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; interface IDocumentDatasets;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; interface IDocumentInfo;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; interface IReportUnitFormat;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; interface IReportUnitFormat2;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; interface IDocumentVersion;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; interface IPersist;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [default, source] interface IDocumentEventsDisp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [source] interface IDocumentEvents;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [source] interface IDataGraphCollectionEvents;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; };&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;An interface has no notion of generic.&amp;nbsp; In the discussion below the word "generic" really means that multiple classes implement a given interface.&amp;nbsp; Your best insight here comes from reading the documentation for the particular interface.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Jun 2011 16:05:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/interfaces-from-the-same-coclass-why-some-need/m-p/119779#M3109</guid>
      <dc:creator>RichardWatson</dc:creator>
      <dc:date>2011-06-20T16:05:53Z</dc:date>
    </item>
    <item>
      <title>Re: Interfaces from the same coclass, why some need explicit QI, some don't?</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/interfaces-from-the-same-coclass-why-some-need/m-p/119780#M3110</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Many thanks for your kindly help, Richard.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Wei&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Jun 2011 13:23:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/interfaces-from-the-same-coclass-why-some-need/m-p/119780#M3110</guid>
      <dc:creator>weiliang</dc:creator>
      <dc:date>2011-06-21T13:23:37Z</dc:date>
    </item>
    <item>
      <title>Re: Interfaces from the same coclass, why some need explicit QI, some don't?</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/interfaces-from-the-same-coclass-why-some-need/m-p/119781#M3111</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am not sure how to tell which is the default interface, I have never really thought of that.&amp;nbsp; I guess I blindly cast when the compiler complains.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I don't use the OMDs much.&amp;nbsp; I remember looking at them 7-8 years ago in confusion.&amp;nbsp; I know people who swear by them but I am not a visual person and I find there are far too many objects and interfaces and links between OMDs and assemblies, the OMDs are just not for me.&amp;nbsp; I use the help files installed with the dev kit or the online ones.&amp;nbsp; If that fails I look in this forum or on google, the OMD is pretty much the last place I look.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Jun 2011 16:09:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/interfaces-from-the-same-coclass-why-some-need/m-p/119781#M3111</guid>
      <dc:creator>AlexanderGray</dc:creator>
      <dc:date>2011-06-21T16:09:00Z</dc:date>
    </item>
    <item>
      <title>Re: Interfaces from the same coclass, why some need explicit QI, some don't?</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/interfaces-from-the-same-coclass-why-some-need/m-p/119782#M3112</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Many thanks for your detailed explain and helpful recommendations, Alexander. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Have a great afternoon!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Wei&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Jun 2011 18:17:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/interfaces-from-the-same-coclass-why-some-need/m-p/119782#M3112</guid>
      <dc:creator>weiliang</dc:creator>
      <dc:date>2011-06-21T18:17:25Z</dc:date>
    </item>
  </channel>
</rss>

