Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
984 views
in Technique[技术] by (71.8m points)

windows - Any sense in marking an IUnknown-derived interface as dual in IDL?

Reviewing our code I've found a curious definition in one of .idl files:

[
    object,
    uuid(uuidhere),
    dual,
    nonextensible,
    oleautomation,
    hidden
]
interface IOurInterface : IUnknown {
    //methods here
};

How can an interface derived directly from IUnknown possibly be a dual interface? Will anything break if I remove the dual attribute?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

In this answer to another question concerning marshaling user voyce points to this article that basically states the following:

When any interface (IDispatch-derived or not) is marked either dual or oleautomation (or both) it is treated specially when RegisterTypeLib() is invoked (which is typically done by DllRegisterServer). For each such interface an HKCRInterface{InterfaceId} key is created under which {00020424-0000-0000-C0000-000000000046} class is referenced as proxy/stub. This class id corresponds to typelib marshaller also known as oleautomation marshaller.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...