Question | Answer |
---|---|
1. How to declare interfaces in VB ? | To create an interface in VB, you simply create a
class module (vis Project->Add Class Module) with empty
methods and properties. For example, the IDataServer interface is declared
as follows: Function
UpdateData(lValue As Long) As Long |
2. How to implement an Interface in VB ? | In the class that you chose to implement an interface, just type Implements <my interface name> and
Visual Basic updates the Code Window with an entry for the interface. For example,
the TheServerComObject has the following two implement statements: Implements
IDataServer |
3. What are the three methods in the Standard (essential) COM Interface IUnknown ? | QueryInterface(), AddRef(), Release() |
4. Who implements the IUnknown interface for your COM objects in VB ? | Visual Basic provides the required implementation behind the scenes. In fact, VB programmers never need to explicitly invoke the IUnknown methods, The VB operators/API such as New(), CreateObject(), Set .... statement invoke the IUnknown methods behind the scenes. |
5. What is the purpose of the standard COM interface IDispatch ? | The IDispatch interface methods allow interpretive clients (such as VB) to access a COM object without using the type library. |