All Manuals > COM/Automation User Guide and Reference Manual > 2 COM Reference Entries

query-interface Function

Summary

Attempts to obtain a COM interface pointer for one interface from another.

Package

com

Signature

query-interface interface-ptr iid &key errorp => interface-for-iid

Arguments
interface-ptr
A COM interface pointer to be queried.
iid
The iid of a COM interface.
errorp
A boolean. The default is t.
Values
interface-for-iid
The new COM interface pointer or nil.
Description

The function query-interface function invokes the COM method IUnknown::QueryInterface to attempt to obtain an interface pointer for iid from interface-ptr.

iid can be a symbol naming a COM interface or a refguid foreign pointer containing its iid.

If IUnknown::QueryInterface returns successfully then the new interface pointer interface-for-iid is returned.

If errorp is true, then nil is returned if the interface pointer cannot be found, otherwise an error of type com-error is signaled.

Examples
(query-interface p-foo 'i-bar)
See also

refguid
com-error
add-ref
release
with-temp-interface
with-query-interface


COM/Automation User Guide and Reference Manual - 01 Dec 2021 19:38:38