2015-02-04 3 views
1

COM 구성 요소에 대한 런타임 호출 가능 래퍼를 생성하도록 Visual Studio에 요청하면 특정 인터페이스 속성을 래핑하는 이상한 유형을 선택합니다. 생성 된 래퍼가이 인터페이스를 선택하는 속성 유형 인 이유는 무엇입니까?

인 성분 A에 대한 요약 형식 라이브러리 :

// Generated .IDL file (by the OLE/COM Object Viewer) 
// 
// typelib filename: prodist.sts.rsfn.dll 

[ 
    uuid(C8FBF2B0-9218-4B0D-9509-C394D65F0566), 
    version(5.4), 
    custom(DE77BA64-517C-11D1-A2DA-0000F8773CE9, 134218331), 
    custom(DE77BA63-517C-11D1-A2DA-0000F8773CE9, 1423076189), 
    custom(DE77BA65-517C-11D1-A2DA-0000F8773CE9, "Created by MIDL version 8.00.0603 at Wed Feb 04 16:56:28 2015 
"), 
    custom(0F21F359-AB84-41E8-9A78-36D110E6D2F9, "prodist.sts.rsfn") 

] 
library prodist_sts_rsfn 
{ 
    // TLib :  // TLib : OLE Automation : {00020430-0000-0000-C000-000000000046} 
    importlib("stdole2.tlb"); 
    // TLib : : {DD00B52D-D8F9-4D5C-ADBD-4E05A68A48CB} 
    importlib("prodist.sts.dll"); 
    // TLib : : {F11596CA-03EE-4756-B502-0327800ED8B4} 
    importlib("prodist.logging.dll"); 

    // Forward declare all types defined in this typelib 
    interface IApiMensageria2; 
    interface IApiMensageria; 
    interface IApiMensageriaContext; 
    interface IStsRsfn; 
    interface IStsRsfnContext; 
    interface IStsRsfnSession; 

    [ 
     uuid(914E8C54-E0F0-4322-8803-8E9EEEE03A01) 
    ] 
    coclass StsRsfn { 
     [default] interface IStsRsfn; 
    }; 

    [ 
     odl, 
     uuid(13385FC6-2618-4830-A3A9-703398AA5A0B), 
     dual, 
     nonextensible, 
     oleautomation 
    ] 
    interface IStsRsfn : IDispatch { 
     [id(0x000003e9), propget] 
     HRESULT Logging([out, retval] IProdistLoggingHierarchy** value); 
     [id(0x000003e9), propput] 
     HRESULT Logging(IProdistLoggingHierarchy* value); 
     [id(0x000003e8), propget] 
     HRESULT Sts([out, retval] ISts** value); 
     [id(0x000003e8), propput] 
     HRESULT Sts(ISts* value); 
     [id(0x000003f1)] 
     HRESULT CreateContext([out, retval] IStsRsfnContext** result); 
     [id(0x000003f2)] 
     HRESULT CreateSession([out, retval] IStsRsfnSession** result); 
    }; 

    // ... 
} 

이 구성 요소 A에 대한 비주얼 스튜디오에 의해 생성되는 런타임 호출 래퍼 :

// Generated .IDL file (by the OLE/COM Object Viewer) 
// 
// typelib filename: prodist.sts.dll 

[ 
    uuid(DD00B52D-D8F9-4D5C-ADBD-4E05A68A48CB), 
    version(5.4), 
    custom(DE77BA64-517C-11D1-A2DA-0000F8773CE9, 134218331), 
    custom(DE77BA63-517C-11D1-A2DA-0000F8773CE9, 1423075247), 
    custom(DE77BA65-517C-11D1-A2DA-0000F8773CE9, "Created by MIDL version 8.00.0603 at Wed Feb 04 16:40:46 2015 
"), 
    custom(0F21F359-AB84-41E8-9A78-36D110E6D2F9, "prodist.sts") 

] 
library prodist_sts 
{ 
    // TLib :  // TLib : OLE Automation : {00020430-0000-0000-C000-000000000046} 
    importlib("stdole2.tlb"); 
    // TLib : : {F11596CA-03EE-4756-B502-0327800ED8B4} 
    importlib("prodist.logging.dll"); 

    // Forward declare all types defined in this typelib 
    interface ISts; 
    interface IStsSession; 
    interface IStream; 
    interface ISequentialStream; 

    [ 
     uuid(EE263AAA-67D4-48DD-9DF5-69ED8CF0D0C9) 
    ] 
    coclass Sts { 
     [default] interface ISts; 
    }; 

    [ 
     odl, 
     uuid(8D841E5C-F25B-4C12-B03A-70A899B3A32E), 
     dual, 
     nonextensible, 
     oleautomation 
    ] 
    interface ISts : IDispatch { 
     [id(0x000003e9), propget] 
     HRESULT Logging([out, retval] IProdistLoggingHierarchy** value); 
     [id(0x000003e9), propput] 
     HRESULT Logging(IProdistLoggingHierarchy* value); 
     [id(0x000003e8)] 
     HRESULT CreateSession([out, retval] IStsSession** result); 
    }; 

    // ... 
} 

이 성분 B에 대한 형식 라이브러리 인 :

[ClassInterface(0)] 
[Guid("EE263AAA-67D4-48DD-9DF5-69ED8CF0D0C9")] 
[TypeLibType(2)] 
public class StsClass : ISts, Sts 
{ 
    public StsClass(); 

    [DispId(1001)] 
    public virtual IProdistLoggingHierarchy Logging { get; set; } 

    [DispId(1000)] 
    public virtual IStsSession CreateSession(); 
} 

[CoClass(typeof(StsClass))] 
[Guid("8D841E5C-F25B-4C12-B03A-70A899B3A32E")] 
public interface Sts : ISts 
{ 
} 

[Guid("8D841E5C-F25B-4C12-B03A-70A899B3A32E")] 
[TypeLibType(4288)] 
public interface ISts 
{ 
    [DispId(1001)] 
    IProdistLoggingHierarchy Logging { get; set; } 

    [DispId(1000)] 
    IStsSession CreateSession(); 
} 

이것은 런타임 호출 가능 래퍼입니다. 구성 요소 B를위한 비주얼 스튜디오 :

[ClassInterface(0)] 
[Guid("914E8C54-E0F0-4322-8803-8E9EEEE03A01")] 
[TypeLibType(2)] 
public class StsRsfnClass : IStsRsfn, StsRsfn 
{ 
    public StsRsfnClass(); 

    [DispId(1001)] 
    public virtual IProdistLoggingHierarchy Logging { get; set; } 
    [DispId(1000)] 
    public virtual Sts Sts { get; set; } 

    [DispId(1009)] 
    public virtual IStsRsfnContext CreateContext(); 
    [DispId(1010)] 
    public virtual IStsRsfnSession CreateSession(); 
} 

[CoClass(typeof(StsRsfnClass))] 
[Guid("13385FC6-2618-4830-A3A9-703398AA5A0B")] 
public interface StsRsfn : IStsRsfn 
{ 
} 

[Guid("13385FC6-2618-4830-A3A9-703398AA5A0B")] 
[TypeLibType(4288)] 
public interface IStsRsfn 
{ 
    [DispId(1001)] 
    IProdistLoggingHierarchy Logging { get; set; } 
    [DispId(1000)] 
    Sts Sts { get; set; } 

    [DispId(1009)] 
    IStsRsfnContext CreateContext(); 
    [DispId(1010)] 
    IStsRsfnSession CreateSession(); 
} 

왜 비주얼 스튜디오는 STS 인터페이스 대신 IStsRsfn.Sts 속성을 포장하는 주의자 인터페이스를 선택하는 것입니다?

답변

0

인터페이스 IStsSts coclass의 기본 인터페이스이며 다른 coclass가이 인터페이스를 구현하지 않기 때문입니다.

이 경우 수입업자는 한 번 보았던 인터페이스를 일부 coclass의 기본 인터페이스로 선택하고 다른 인터페이스는 구현하지 않았을 것입니다.