9.6.10 OleQueryProtocol

LPVOID OleQueryProtocol(lpobj, lpprotocol)

LPOLEOBJECT lpobj;

LPCSTR lpszProtocol;

The OleQueryProtocol function checks whether an object supports a specified protocol.

Parameter Description

lpobj Points to the object to query.
lpszProtocol Points to a null-terminated string specifying the name of the requested protocol. This value can be "StdFileEditing" or "StdExecute." Object handlers may support other protocols identified by other names.

The OleQueryProtocol function queries whether the specified protocol is supported and returns a modified object pointer that allows access to the function table for the protocol. This modified object pointer points to a structure that has the same form as the OLEOBJECT structure; the new structure also points to a table of functions and may contain additional state information. The new pointer does not point to a different object–if the object is deleted, secondary pointers become invalid. If a protocol includes delete functions, calling a delete function invalidates all pointers to that object.

A client application typically calls the OleQueryProtocol function, specifying "StdExecute" in the lpszProtocol parameter, before calling the OleExecute function. This allows the client application to check whether the server for an object supports DDE execute commands.

The return value is NULL if the object does not support the requested protocol. Otherwise, the return value is a VOID pointer to a data structure similar to the OLEOBJECT structure, but the entries in the corresponding VTBL structure depend on the requested protocol.

For the standard protocols, StdFileEditing and StdExecute, the return value is an OLEOBJECT pointer with corresponding VTBL entries. If an object handler supports additional protocols, the entries in the VTBL structure may be different. Since the caller knows the string name to request, the caller must know the definition of the corresponding VTBL entries.

The DLL can return OLE_WAIT_FOR_RELEASE when an application calls this function.

See AlsoOleExecute