COM은 새 구성 요소 또는 응용 프로그램을 릴리스 할 때 이전 버전과의 호환성을 유지하는 것으로 알려져 있습니다. 이는 COM의 인터페이스가 안정적이기 때문에 가능합니다. 즉, 변경되지 않습니다.COM 인터페이스를 발전시키는 방법은 무엇입니까?
COM 인터페이스를 버전간에 변환하는 방법에 대한 설명을 다루는 참고서 나 책을 찾기 위해 열심히 노력했습니다.
다음
내 요구 사항 :우리는 OLE 자동화에 의해 구동 될 수있는 응용 프로그램이 있습니다. 이 응용 프로그램의 새 버전은 parrallel에서 이전 버전으로 설치할 수 있습니다.
이 응용 프로그램의 COM 클라이언트는 버전 독립적 인 PROGID를 사용할 수 있습니다.이 경우 최신 버전의 응용 프로그램 또는 버전 종속 PROGID를 사용하여 특정 버전의 응용 프로그램에서 작동합니다.
COM 자동화를 변경해도 클라이언트가 손상되지 않아야합니다.
#include <olectl.h>
#include <fxbase\autoif.h>
[
uuid(A1B3A66F-806F-46a2-82D9-9C278F415148),
lcid(-1),
version(1.0)
]
library LIB
{
importlib("stdole2.tlb");
[
uuid(82CDE055-790A-4505-BF3E-3282170C8FC6),
helpstring("Document"),
oleautomation,
dual,
nonextensible
]
interface IDocument : IDispatch
{
[id(0x00000001), propget, helpcontext(0x0012c94a)]
HRESULT Name([out, retval] BSTR* psName);
[id(0x00000001), propput, helpcontext(0x0012c94a)]
HRESULT Name([in] BSTR psName);
}
[
uuid(919B9E6E-76C0-4c23-A188-5840E5900997),
helpstring("Application object."),
oleautomation,
dual,
nonextensible
]
interface IApplication : IDispatch
{
[id(0x00000001), propget, helpstring("Returns the active document of the application.")]
HRESULT ActiveDocument([out, retval] IDocument** retval);
}
[
uuid(E0AA6FCA-AEF1-460b-A1F9-26250C28594B),
helpstring("Application 1.0 Class"),
appobject
]
coclass Application
{
[default] interface IApplication;
interface IDispatch;
}
}
내가 어떤 인터페이스를 확장이 응용 프로그램의 버전 2.0을 게시 할 말 있습니다 :
는 예를 볼 수 있습니다. 다음은 버전 2.0에 대한 나의 순진한 접근 방식입니다.
#include <olectl.h>
#include <fxbase\autoif.h>
[
uuid(3D4688A2-91F8-4cd8-989A-845810A05557),
lcid(-1),
version(2.0)
]
library LIB
{
importlib("stdole2.tlb");
[
uuid(82CDE055-790A-4505-BF3E-3282170C8FC6),
helpstring("Document"),
oleautomation,
dual
]
interface IDocument10 : IDispatch
{
[id(0x00000001), propget, helpcontext(0x0012c94a)]
HRESULT Name([out, retval] BSTR* psName);
[id(0x00000001), propput, helpcontext(0x0012c94a)]
HRESULT Name([in] BSTR psName);
}
[
uuid(AF404510-216A-407e-99F4-0636AF071B68),
helpstring("Document"),
oleautomation,
dual,
nonextensible
]
interface IDocument : IDocument10
{
[id(0x00000001), propget, helpcontext(0x0012c94a)]
HRESULT Type([out, retval] BSTR* psType);
[id(0x00000001), propput, helpcontext(0x0012c94a)]
HRESULT Type([in] BSTR psType);
}
[
uuid(919B9E6E-76C0-4c23-A188-5840E5900997),
helpstring("Application object."),
oleautomation,
dual
]
interface IApplication10 : IDispatch
{
[id(0x00000001), propget, helpstring("Returns the active document of the application.")]
HRESULT ActiveDocument([out, retval] IDocument** retval);
}
[
uuid(6A851C3F-21DF-4f5e-A4D6-2EF5A9D234C6),
helpstring("Application object."),
oleautomation,
dual,
nonextensible
]
interface IApplication : IApplication10
{
[id(0x00000002), propget, helpstring("Is the application visible.")]
HRESULT Visible([out, retval] BOOL* retval);
}
[
uuid(AA760349-1682-4ab6-BF0C-C02E620715CF),
helpstring("Application 2.0 Class"),
appobject
]
coclass Application
{
[default] interface IApplication;
interface IDispatch;
}
}
올바른 방법입니까?
스크립트 클라이언트에 다른 버전의 응용 프로그램을 인스턴스화 할 수있는 가능성을 추가하기 위해 Application10 및 Application20 클래스를 레지스트리에 추가해야합니까?
및 형식 라이브러리의 GUID를 변경하는 것이 맞습니까?
버전 2.0의 IDocument에는 새로운 IID가 있습니다. IApplication.ActiveDocument에서 IDocument를 계속 사용할 수 있습니까?
다른 버전의 Windows 레지스트리에 coclass 또는 인터페이스를 어떻게 등록해야합니까?
ATL 또는 WIN32-API 이외의 다른 라이브러리는 사용하지 않습니다.
어디에서이 정보 (책, 참고 자료 등)를 찾을 수 있는지 알고 계시다면 제안 해주십시오.
정말 감사드립니다.
정말 Microsoft Office 레지스트리 항목에서 배우고 싶지만 이전 버전이 없습니다. 당신은 배우기 위해 프리웨어 프로그램을 알고 있습니까? – frast
왜 CLSID를 변경해야합니까? 구현은 여전히 모든 인터페이스를 구현합니다. 맞습니까? –
@frast 또는 IE를 확인하십시오. –