IUnknown

From Xojo Documentation

Class (inherits from Object)


IUnknown is the common interface supported by all COM objects.

Properties
Handle


Methods
AddRef Release
QueryInterface


Constructors

Constructor(p As Ptr)


Examples

The following automates Internet Explorer and queries for a specific interface (each interface is identified by a unique IID)

Var ie As New OLEObject("InternetExplorer.Application")
ie.Visible = True
ie.Navigate("google.com")

Var unk As New COM.IUnknown(ie.Handle)

// Query for the IID_IWebBrowser2 interface
Var iid As MemoryBlock = COM.IIDFromString("{D30C1661-CDAF-11D0-8A3E-00C04FC9E26E}")
Var out As Ptr
If 0 = unk.QueryInterface(iid, out) Then
// Yay this interface exists
Break
End If

See Also

COM module; IDispatch, IEnumVARIANT, IPicture.