A COM class ("coclass") is a concrete implementation of one or more interfaces. Interfaces are closely resembles to abstruct classes in C++. Coclass in a COM server can implement one or more interfaces. Multiple inheritance is used to implement multiple interfaces in same C++ class. Client has to select the desired interface for using an object of the co-class. Each interface will have different GUID or IID and human readable progid. Client should provide CLSID for the Co_Class and interface ID or IID for getting an instance of the co-class from the server.

[
uuid(0002DF01-0000-0000-C000-000000000046), // CLSID_InternetExplorer
helpstring("Internet Explorer Application."),
]

coclass InternetExplorer
{
  [default]     interface   IWebBrowser2;
  interface   IWebBrowserApp;
  [default, source] dispinterface DWebBrowserEvents2;
  [source]      dispinterface DWebBrowserEvents;
}

Default keyword is used to specify the default interface for the co-class. VB/VB Script or Java script uses the default interface for accessing an instance if it is not spefified.

About our authors: Team EQA

You have viewed 1 page out of 67. Your COM/DCOM learning is 0.00% complete. Login to check your learning progress.

Learn on Youtube

#